rails_admin js/css no longer precompile in 0.0.4 #1192

rystraum opened this Issue Jun 6, 2012 · 17 comments


None yet

rystraum commented Jun 6, 2012

Just started a new rails project with 0.0.4 and production fails because it can't find pre-compiled rails_admin.js/css.
I downgraded my rails_admin to 0.0.3 and ran

rake assets:clean && RAILS_ENV=production rake assets:precompile 

and it precompiled rails_admin js/css.
Images are found and are precompiled in both cases, so it's just the CSS and JS that aren't precompiled.


hugomaiavieira commented Jun 6, 2012

Same issue here


bbenezech commented Jun 6, 2012

Maybe related to 152dc34

Same here with 0.0.4

ActionView::Template::Error (rails_admin/rails_admin.css isn't precompiled):
    4:     %meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}
    5:     %meta{:content => "NONE,NOARCHIVE", :name => "robots"}
    6:     = csrf_meta_tag
    7:     = stylesheet_link_tag "rails_admin/rails_admin.css", :media => :all
    8:     = javascript_include_tag "rails_admin/rails_admin.js"

qqshfox commented Jun 7, 2012

#1046 This works for me.


bbenezech commented Jun 8, 2012

What exactly worked for you, @qqshfox ?

parkr commented Jun 15, 2012

I get Undefined variable: "$red". in rails_admin/base/theming.css.scss:19 when I run rake assets:precompile

Here's my rake stack trace and application.rb file.

@qqshfox 's solution worked great. Thanks!

Edited the documentation for troubleshooting: https://github.com/sferik/rails_admin/wiki/Troubleshoot/_compare/4628de8a65028be16d2e6d9834ec28a55eca4e0c...863f5656f25ebac5652f903f18240f251d0b6fff

Although, if this problem is universal (that is everyone would absolutely, without a doubt, run into this problem), I think having it buried in the Troubleshoot wiki page is not the best way to go about this.

Probably having it up as a note when people run

rails generate rails_admin:install

instead, much like how Devise does their own post-install notes?
If people think the troubleshooting documentation is enough, I will close this issue.

parkr commented Jun 18, 2012

Added that, @rystraum, but didn't help:

/usr/local/Cellar/ruby/1.9.3-p194/bin/ruby /usr/local/bin/rake assets:precompile:all RAILS_ENV=development RAILS_GROUPS=assets
rake aborted!
Undefined variable: "$red".
  (in /usr/local/lib/ruby/gems/1.9.1/gems/rails_admin-0.0.4/app/assets/stylesheets/rails_admin/base/theming.css.scss)

Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
rake aborted!
Command failed with status (1): [/usr/local/Cellar/ruby/1.9.3-p194/bin/ruby...]

Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

@mshibuya mshibuya added a commit that referenced this issue Jun 18, 2012

@mshibuya mshibuya Change initializer's group to :all to ensure it to be executed on bot…
…h initialize_on_precompile = true and false. Refs #1192

mshibuya commented Jun 18, 2012

I've made slight modification to changes made by #1135.
I think this should fix the issue both on config.assets.initialize_on_precompile = false and true environment, but I've tested only locally.
Is there anyone who can see if it works on production envs(especially on Heroku) as expected?

Yours is not related to this issue.
You'd better check discussions in #682 and #988.

chewi commented Jun 21, 2012

What I don't understand is whether this change was intentional. Are we supposed to add these to config.assets.precompile now? That doesn't seem right to me.

@chewi: That's why I suggested having it up as a note when you first run rails g rails_admin:install, if it was indeed intentional. In general, I don't mind, as long as it's documented anywhere.


mshibuya commented Jun 21, 2012

@chewi @rystraum
This is a regression, not an intentional issue.
And should be resolved by my recent commit, so can you guys see if the latest master precompiles RailsAdmin assets without adding config.assets.precompile += ... configuration?


morgoth commented Jul 4, 2012

@mshibuya it's working. This issue can be closed

mshibuya closed this Jul 4, 2012

I am using 0.1.x version and I still need to follow those steps of remove the catch all, and add the +=

heaven commented Nov 15, 2014

I was using:

Rails.application.config.assets.precompile << /(^[^_\/]|\/[^_])[^\/]*$/

How should I handle this now? Do I need to specify all files manually? that doesn't seem right to me.

UPD. Fixed this way:

Rails.application.config.assets.precompile << /(?:^(?!rails_admin)(?:[^_\/]|\/[^_])+)[^\/]*$/
Rails.application.config.assets.precompile += %w[rails_admin/rails_admin.css rails_admin/rails_admin.js]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment