When it comes time to deploy your new web application, instead of sending down a dozen javascript and css files full of formatting and comments, this Rails plugin makes it simple to merge and compress JavaScript and CSS down into one or more files, increasing speed and saving bandwidth. When in development, it allows you to use your original versions and retain formatting and comments for readability and debugging. Because not all browsers will dependably cache javascript and css files with query string parameters, AssetPackager writes a timestamp or subversion revision stamp (if available) into the merged file names. Therefore files are correctly cached by the browser AND your users always get the latest version when you re-deploy. This code is released under the MIT license (like Ruby). You’re free to rip it up, enhance it, etc. And if you make any enhancements, I’d like to know so I can add them back in. Thanks!
Asset packager helped me easily satisfy Yslow's requirement that you should have a minimal number of externally linked javascripts and/or css files. It will combine all javascript files into one, and all css files into one for use in production mode. It also compresses the files by removing white spaces first. For javascript compression, there are a couple of things to watch out for: 1) it won't like it if you don't use semicolons at the end of your statements; 2) it will not work with third party javascript libraries that try to inspect the name of the js file that contains itself, because Asset Packager renames the js file.
