Jammit: Industrial Strength Asset Packaging for Rails Apps
Earlier this year on Ruby Inside, we wrote about Sprockets - a Ruby library from 37signals that could take the various JavaScript files used in your project and compress them down on the fly into smaller portions to be more easily sent over the wire. Now, however, say hello to Jammit, an "industrial strength" asset packaging library for Rails that handles not only JavaScript, but also CSS and inline images.
Asset packaging is nothing new, but Jammit has an unusual feature in that it can take small images used on your site and embed them into your CSS file using the data-uri mechanism. The benefit is that you reduce the number of files that need to be downloaded to render a single page - significant as most browsers have a limit to the number of files they can retrieve simultaneously from the same host.
Jammit has a well designed GitHub hosted homepage that goes into how to install it (just install a gem, add the reference to environment.rb, and add a route into config/routes.rb), set it up to take note of your assets (all done via a YAML file), and get things running in your views (add some helpers to your main layout), so refer to that for further details.
[ad] Find duplication, code smells, complex code and more in your Ruby code with Caliper! The metrics are free and setup takes just one click. Get started!
November 30th, 2009 at 10:01 pm
[...] A rails package I just came across does the same thing - check out http://documentcloud.github.com/jammit/ mentioned in Rails Inside. [...]
February 16th, 2010 at 3:58 am
xyz testing