I wanted ta take a minute to highlight Jammit, one of the most useful (and best documented) plugins I’ve used lately. Jammit is a really easy way to get CSS and Javascript minification and bundling with really low development overhead.
After installing the gem, it’s as simple as setting up your bundles in an assets.yml that looks something like this:
From code, these bundles can be referred to with the include_stylesheets and include_javascripts methods. When using these functions in development mode, the unminified, unbundled assets are included. In production environments, I wrote a capistrano task to bundle these up using the jammit command provided by the gem:
This minifies, bundles, and gzips all the assets and dumps them in the public/ directory, making generating these bundles something we don’t ever need to think about again.
Way better than the manual bundling rake tasks we were using before.
Leave a comment