0
votes

I have a problem with js files being compiled in development.

I have an application.js file that includes multiple other files like this:

//=require_tree .

the files in the directory are

app/assets/javascripts/user_row.coffee
app/assets/javascripts/index.coffee

Whenever I make a change to one of those files a corresponding js file gets created in the app/assets/javascripts directory, so I change user_row.coffee and I get:

app/assets/javascripts/user_row.js

This is in development mode, with the default asset configuration (I haven't changed development.rb from what the rails generator creates).

If I change the user_row.coffee file again, it gets overlooked and the already existing js file gets included by application.js.

What I don't understand are why these js files being created in the app/assets/javascript directory rather than under tmp/cache/...

Any ideas?

2
What command are you using to start your development server? - Andrew Hare
What does it say in the development log relating to the js files? It should list not only the assets it's grabbing, but also what assets it compiles for the request. That might shed some light on the problem. - GorrillaMcD
The log doesn't say anything. The file gets generated after the coffee file gets saved prior to refreshing any page. This only happens when the server is running though. - Mina Smart
When I access Rails.application.config[:assets] through the console I see the following: :cache_store => [ [0] :file_store, [1] "/Users/[...]/tmp/cache/assets/" ] which to me looks like things should be stored in tmp/cache/assets.... Am I wrong? - Mina Smart

2 Answers

0
votes

You should name the coffee files name.js.coffee instead of just name.coffee.

0
votes

This turned out to be an issue with nodes v0.8.9. I'm using node as the javascript runtime, and after updating from v0.8.9 to v0.8.16, the problem went away.