Fellps
Fellps

Reputation: 415

Uglify JavaScript code with Sprockets

My project was builded in Rails 2 and was upgraded to Rails 3.1, so I'm having troubles with the assets pipeline configuration, such as precompile.

I'm using app/assets/aplication.js like:

//= require jquery 
//= require jquery_ujs

My application.rb is:

config.assets.js_compressor = :uglifier

My Gemfile contains uglifier gem:

gem 'uglifier'

After that I performed:

rake assets:precompile

and the result code from public/assets/application.js isn't uglified, but when I put this configuration on application.rb:

config.assets.compress = true

the file is uglified.

Isn't the config.assets.compress configuration used for live compilation? Why does my precompile rake only uglify with this option enabled?

Upvotes: 1

Views: 885

Answers (1)

Ryan Bigg
Ryan Bigg

Reputation: 107718

Compressing is uglifying. If you don't have that option, then compressing/uglifying doesn't happen. If you want uglifying to happen, enable that option.

Upvotes: 1

Related Questions