I have following configurations in production.rb
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Choose the compressors to use
config.assets.js_compressor = :uglifier
config.assets.css_compressor = :yui
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs.
config.assets.digest = true
But when the ruby on rails application on production server I get following error:
Error compiling CSS asset
LoadError: cannot load such file -- yui-compressor
on commenting line LoadError: cannot load such file -- yui-compressor
,everything goes well.
All I need a compressor that gzip compress assets before sending to improve performance!
so,what is problem here or is there any other alternative?
Also javascript compression is not working,as yslow plugin for firefox also showing javascripts needs to be compressed.
Have you included the yui-compressor gem in your Gemfile? If not, then include it, run 'bundle install', and then Rails should be able to find it.
I found that the to have effect. 上生效。
All that is needed is to add following:
AddOutputFilterByType DEFLATE text/html text/css application/x-javascript application/javascript
in <VirtualHost *:80></VirtualHost>
directive for Apache(phusion passenger) for my case.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.