2012-07-13 114 views
2

Rails 3.2中的開發模式中可以使用壓縮的js嗎?的Gemfile包含Rails 3.2和資產管道:開發模式下的JavaScript壓縮

 gem "closure-compiler" 

和development.rb包含

config.serve_static_assets = true 
    config.assets.compile = false 
    config.assets.debug = false 
    config.assets.js_compressor = :closure 
    config.assets.compress = true 

有拼命地跑

RAILS_ENV=development bundle exec rake assets:precompile 

而且,即使已編譯的application.js是那裏:

./public/assets/application/application.js 
./public/assets/application/application.js.gz 
./public/assets/jasmine_rails/application.js 
./public/assets/jasmine_rails/application.js.gz 

......它永遠不會得到滿足。

回答

0

這種結構使工作:

config.cache_classes = true 
    config.whiny_nils = true 
    config.consider_all_requests_local  = false 
    config.action_controller.perform_caching = true 
    config.serve_static_assets = true 
    config.assets.compress = true 
    config.assets.js_compressor = :closure 
    config.assets.debug = false 
    config.assets.compile = false 
    config.assets.digest = true 
相關問題