Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails 3.1 some assets not precompiling on production

I was running into issues with Heroku showing my 'places.js' was not precompiled, even though im running on the cedar stack, and during the slug compilation it is running the rake precompile task. so i tried running it locally with rake assets:precompile RAILS_ENV=production and indeed rails was not precompiling my /app/assets/javascripts/places.js.coffee.erb asset.

my production.rb is using default rails 3.1 configuration, and i even tried removing the .erb from the asset, but to no avail.

I also thought since my places.js.coffee.erb asset is NOT included in the sprockets manifest (i include it manually in my app), perhaps it only precompiles assets in the manifest. Requiring it in the manifest didn't work either.

only my application.js.coffee and `application.css are precompiling (with and without a digest).

the only issue i found was possibly poor regex being used to match assets, but the default of (?:\/|\\|\A)application\.(css|js)$ does not match my asset, so it should be included.

i am not sure how to troubleshoot from here. everything is pretty much default. any thoughts on what could be happening here?

like image 953
brewster Avatar asked Nov 17 '11 06:11

brewster


1 Answers

Firstly, if you want a file to compile when it is not in a manifest, you need to add it to the precompile config option:

config.assets.precompile += ['places.js']

Secondly, can you edit your question to include your manifest - it may be a syntax issue. I will edit this answer if I can see what the issue might be.

like image 156
Richard Hulse Avatar answered Oct 13 '22 00:10

Richard Hulse