Skip to content

Rails plugin for automatically and smartly shrinking your javascript and css

License

Notifications You must be signed in to change notification settings

joevandyk/fixie_shrinker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Rails plugin for automatically and smartly shrinking your javascript and css

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published