Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
441 views
in Technique[技术] by (71.8m points)

asset pipeline - uglifier not working in rails

config/application.rb
...
# Enable the asset pipeline
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'
config.assets.digest = true
config.assets.paths << "#{Rails.root}/vendor/assets/images" 
...


config/environment.rb
...
ENV['RAILS_ENV'] ||= 'production'
...

My gemfile
...
gem 'uglifier'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails', "  ~> 3.1.0"
  gem 'coffee-rails', "~> 3.1.0"
  #gem 'uglifier'
end
...

environment/production.rb
....
    config.active_support.deprecation = :notify
    config.assets.enabled = true
    config.assets.js_compressor  = :uglifier
    config.assets.css_compressor = :scss
    config.assets.compress = false
...

I have my javascript files in app/assets/javascripts. My javascript files are not getting compressed. Followed this url http://dev.mensfeld.pl/category/rails3/ to workout compression.

Thanks for any directions.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

In environment/production.rb:

...
config.assets.compress = true
...

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...