cache-with-yuicompressor
This gem sets up javascript and CSS bundle file compression using the YUI Compressor.
For example, using
javascript_include_tag "prototype", "cart", "checkout", :cache => "shop"
creates a combined javascript file named shop.js. With this gem, YUI compressor will also be run on shop.js, resulting in a smaller, obfuscated file.
Don’t forget to use GZip to further compress your asset files.
Installation
cache-with-yuicompressor is provided as a gem. Simply include it in your environment.rb or Gemfile.
config.gem "cache-with-yuicompressor"
Alternatively it can be installed as a plugin.
script/plugin install git://github.com/amolk/cache-with-yuicompressor.git
Install JAVA
The YUI compressor requires JAVA runtime to be installed. Install JRE as per your platform.
For Ubuntu, you can follow instructions at blog.amolkelkar.info/technotes/2010/06/solved-how-to-install-java-jre-on-ubuntu/.
And that’s it!
All generated javascript and css files will be automatically compressed using YUI Compressor.
Also all console.* calls (such as console.log, console.trace) will be removed from javascript.