CachedAssets
Rails plugin to intended to help reduce the number of HTTP requests when loading static assets like stylesheets and JavaScript files.
Installation
To get the latest version:
script/plugin install http://cachedassets.googlecode.com/svn/trunk
Usage
Instead of using the default Rails helpers like
<%= javascript_include_tag :defaults %> <%= stylesheet_link_tag 'scaffold' %>
use:
<%= cached_javascript_include_tag :defaults %> <%= cached_stylesheet_link_tag 'scaffold' %>
The key here is to have as few of these statements as possible because the plugin will make a single asset from the list of sources.
So, if you might have something like:
<%= javascript_include_tag :defaults %> <%= javascript_include_tag 'lightbox' %> <%= javascript_include_tag 'yui/yahoo-min', 'yui/event-min', 'yui/treeview-min' %>
then you want to combine them into a single statement, like so:
<%= cached_javascript_include_tag :defaults, 'lightbox', 'yui/yahoo-min', 'yui/event-min', 'yui/treeview-min' %>