Rails 3.1: Why does rails_admin cause rake asset: precompile to fail?

EDIT

This question should be: Why does rails_admin rake asset:precompilefail?

I upgrade from Rails 3.0 to 3.1 and enable the asset pipeline. Somewhere along the way, rails_admin interrupted my activation before compilation:

-----> 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? $reddefined (in another rails_admin.css file). So why can’t theming.css.scssyou access it? How can I avoid this?

+5
source share
3 answers

I fixed this in the config / environment / production.rb file: I replaced the line

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

in another

config.assets.precompile += %w(rails_admin/rails_admin.css rails_admin/rails_admin.js)

This solution works for rubies 1.9.3 and rails 3.1

+9
source

! - Heroku.

rails_admin.css .js. :.

  • , - catch-all *. (css | js) config.assets.precompile
  • , require_tree . application.(css|js)

, . , css , , $red, .

+3

, base.css - , /app/assets/stylesheets/rails _admin/base/theming.css.scss. $red.

CSS , , . - $red , .

You can fix this in one of two ways: replace $redtheming.css.scss with the actual color code, or move the variables to a file and import this file. For example, in my application, I put all my color variables in "color_codes.css.scss". Then, in any stylesheet where I need to reference them, I add a line @import "color_codes";to the beginning of the sheet.

+2
source

All Articles