Cached Assets plugin

Plugin details

Rails plugin to intended to help reduce the number of HTTP requests when loading static assets like stylesheets and JavaScript files.

Websitehttp://code.google.com/p/cachedassets/ Repositoryhttp://cachedassets.googlecode.com/svn/ Author Istvan Hoka Tags Cache, asset LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install http://cachedassets.googlecode.com/svn/

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' %>

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: hardway, 7 months ago