Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade to Rails 3.1.0 from rc6, asset precompile fails

After I upgrade to Rails 3.1.0 from Rails 3.1.0.rc6, I got some error messages when running assets:precompile task like this:

$ RAILS_ENV=production RAILS_GROUPS=assets rake assets:clean tmp:clear assets:precompile
rake aborted!
ie-spacer.gif isn't precompiled
  (in app/assets/stylesheets/jquery.gritter.css.scss)

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

I tried add config.assets.precompile << 'ie-spacer.gif' to config/application.rb, but it still fails.

The line in jquery.gritter.css.scss is:

background: asset_url('ie-spacer.gif', image);

and I tried:

background: asset_path('ie-spacer.gif', image);
background: image_url('ie-spacer.gif');
background: image_path('ie-spacer.gif');

all failed with ie-spacer.gif isn't precompiled.

like image 801
ayaya Avatar asked Aug 31 '11 05:08

ayaya


People also ask

How do you Precompile Rails assets?

To compile your assets locally, run the assets:precompile task locally on your app. Make sure to use the production environment so that the production version of your assets are generated. A public/assets directory will be created. Inside this directory you'll find a manifest.

What is assets Precompile?

rails assets:precompile is the task that does the compilation (concatenation, minification, and preprocessing). When the task is run, Rails first looks at the files in the config.assets.precompile array. By default, this array includes application.js and application.css .


1 Answers

You have to do

config.assets.compile = true

during the assets:precompile task.

Seems to be a bug in rails 3.1.

like image 138
pinguin666 Avatar answered Oct 11 '22 16:10

pinguin666