Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails Asset Pipeline Better Error or Stack Trace

Just upgraded an app from rails 3.0.9 to 3.2.1 and when i run bundle exec rake assets:precompile I get errors, which is fine however the backtrace doesn't tell me where in my css or scss files the syntax problem is coming from. I tried greping for "0ee5c0e69c92af0" but that string doesn't appear in my project.

bundle exec rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
Invalid CSS after "...0ee5c0e69c92af0": expected ";", was ".png;"

Is there a way to get a better error message or stack trace from the precompilation process? Is there another way I can compile my css.erb files to check for syntax without this task?

like image 469
Schneems Avatar asked Jan 31 '12 02:01

Schneems


1 Answers

There is not a better way that I know of, because this message is generated by Sprockets (actually the CSS processor) after it has concatenated all the files together.

One thing you could do (temporarily) is replace the default precompile array in application.rb with this:

config.assets.precompile = ['*.css']

Then remove any requires from your application.css and run the precompile task locally. This will compile each CSS file individually, and hopefully give you more clues as to where the problem is.

like image 77
Richard Hulse Avatar answered Oct 05 '22 22:10

Richard Hulse