Agile Web Development

Build it. Launch it. Love it.

CachedAssets

CachedAssets

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

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

Documentation

Not much to document. Take a look at the plugin rdoc.

Vitals

Home http://code.google.com/p/cachedassets/
Repository http://cachedassets.googlecode.com/svn/
License Rails' (MIT)
Tags Tag_red asset assets css http javascript
Rating (5 votes)
Owner Istvan Hoka
Created 8 April 2007

Comments

  • Sergey
    9 April 2007

    What is difference with build-in rails

    javascript_include_tag :defaults, :cache => true

Add a comment