This question should be: Why is rails_admin causing rake asset:precompile
to fail?
I'm upgrading from Rails 3.0 to 3.1 and enabling the asset pipeline. Somewhere along the way, rails_admin broke my asset precompiling:
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
Undefined variable: "$red".
(in /tmp/build_zkm1tzzdhdh6/vendor/bundle/ruby/1.9.1/bundler/gems/rails_admin-a887eee6e916/app/assets/stylesheets/rails_admin/base/theming.css.scss)
Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
Precompiling assets failed, enabling runtime asset compilation
Injecting rails31_enable_runtime_asset_compilation
Please see this article for troubleshooting help:
http://devcenter.heroku.com/articles/rails31_heroku_cedar#troubleshooting
What's going on here? $red
is defined (in a different rails_admin .css file). So why isn't theming.css.scss
able access it? How do I avoid this?
I fixed this in the file config/environments/production.rb: I replaced the line
config.assets.precompile = ['*.js', '*.css']
to another
config.assets.precompile += %w(rails_admin/rails_admin.css rails_admin/rails_admin.js)
This solution is working for ruby 1.9.3 and rails 3.1
Whoa! I found the problem -- it's a known issue on Heroku.
You can't blanket-include the rails_admin .css or .js files. i.e.:
config.assets.precompile
require_tree .
in application.(css|js)
My problem is that I'm doing the former. That's causing my css files to be loaded in isolation, so that variables, like $red
, aren't shared correctly between them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With