Minified Cache is a Ruby on Rails Plugin that takes rails built-in asset caching one step further by optimizing javascript_include_tag..cache=>... to be minified!
Check out the official github page at: http://github.com/cornflakesuperstar/minified_cache
Sample file reductions:
| prototype.js (version 1.6.0.3): | from 127kb to 94kb | saves 33kb (26% size reduction) |
| prototype.js, effects.js, dragdrop.js, controls.js (rails :defaults): | from 229kb to 168kb | saves 61kb (27% size reduction) |
Note: this plugin was put together on rails 2.2.2. It probably needs some tweaking for older rails versions.
DESCRIPTION
===========
This monkey patch of ActionView::Helpers::AssetTagHelper uses the jsmin library to minify cached
javascript so that you can pass the YSlow test! When you call:
<%= javascript_include_tag 'application', 'other_js_source', :cache => 'application_cached' %>
then the resulting generated #{RAILS_ROOT}/public/javascripts/application_cached.js will be
served minified (assuming config.action_controller.perform_caching = true)
INSTALLATION
=============
git clone git://github.com/cornflakesuperstar/minified_cache.git vendor/plugins/minified_cache && rm -rf vendor/plugins/minified_cache/.git
WARNING
=======
In order to minify your javascript, it must be formatted with appropriate function closure and
braces eg:
if(condition) alert('msg')
else alert('othermsg')
is handled gracefully by browsers (thanks to the newline), however when it gets compressed to:
if(condition) alert('msg')else alert('othermsg')
you can expect some kaboom.
check out http://www.jslint.com/ to verify your scripts
HOMEPAGE
========
http://www.kangarooit.com/minified_cache
Copyright (c) 2009 Jason Kotchoff, released under the MIT license