bundle_fu for JS/CSS concatenation/minimisation

One of the ‘best practices’ to speedup your site (suggested also by YSlow) is to minify/compress/concatenate in one file the JS and CSS files.

Rails 2.0 has a new feature for accomplishing this, as shown here.

However, Rails does not provide JS compression. The bundle_fu plugin comes in handy for this, autocompressing the JS files.

Below are the features, pasted from the main site:

  • Does not require a separate config file
  • Automatically regenerates the bundle if you modify an included file, or change the include order.
  • Is easily bypassed by passing “?bundle_fu=false” into your page (including assets separately vs bundled). It does not affect other users of your site, and stays bypassed for the your session only. Bundle-fu makes debugging fun!
  • Is optimized for production mode (only generates the bundle file once when the server is first started).
  • Puts the bundles in javascripts/cache and stylesheets/cache, so it’s easy to ignore with subversion.
  • Rewrites relative URLs in your CSS files, so you’ll never have broken images.
  • Minimizes your javascripts by default using the Ruby Version of JSMin. Optionally, if you install PackR, it will automatically use that instead.
  • No additional requests on your rails application – bundled files are served as static files.
  • Supports multiple combinations of JS/CSS, using the :name parameter

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: