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?
Update:
Also javascript compression is not working,as yslow plugin for firefox also showing javascripts needs to be compressed.
I found that the compression must be enabled on webserver 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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With