Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Rails plugin for automatically and smartly shrinking your javascript and css
Ruby JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
tasks
test
MIT-LICENSE.txt
README.rdoc
Rakefile
YUI-COMPRESSOR-LICENSE.txt
init.rb

README.rdoc

Fixie Shrinker is a Rails plugin that uses the YUI Compressor ( developer.yahoo.com/yui/compressor/ ) to automatically compress both CSS and Javascript files.

Javascript and CSS are continually compressed in development mode. You deploy the compressed javascript and css, so there is no server-side compression necessary. Because the YUI Compressor is ran on each page refresh (if the javascript or css changed), you are immediately alerted to any javascript or css errors. No more waiting until deployment to realize that your javascript can't be minified!

Use like so, where the first filename is the name that you want your javascript (or css) file to be compressed as.

<%= compress_and_include_javascripts 'compressed_javascript.js',   'javascript', 'javascript2' %>
<%= compress_and_include_stylesheets 'compressed_stylesheets.css', 'stylesheet', 'stylesheet2' %>

Few notes:

  • YUI Compressor seems to have problems minifying already minified javascript. Use uncompressed human-readable javascript libraries.

  • If there is an error that prevents YUI Compressor from working, it will compress each javascript file, one by one. This will take a little bit of time, but shouldn't happen that often.

  • If you work with bad javascript code, it might be necessary to not have YUI Compressor work on it – so you'd use javascript_include_tag('calendar.js') or whatever.

Inspired from github.com/mudge/asset_compressor/tree/master

Copyright © 2008 Joe Van Dyk, Fixie Consulting. fixieconsulting.com

YUI Compressor is Copyright © 2006 Yahoo! Inc. All rights reserved. See YUI-COMPRESSOR-LICENSE.txt for more information.

Something went wrong with that request. Please try again.