Handling asset caching nicely in Rails 2.0

update: fix some incorrect paths that did not have the public in front. (thanks Jon)

From your rails root:

mkdir public/javascripts/cache mkdir public/stylesheets/cache svn add public/javascripts/cache/ svn add public/stylesheets/cache/ svn propset svn:ignore '' public/javascripts/cache/ svn propset svn:ignore '' public/stylesheets/cache/ svn ci -m "add cache directories for combined assets, but ignore their contents"

Then wherever you are doing the js and css includes:

< %= stylesheet_link_tag "application_v2", "foo_styles", :cache => "cache/styles" %> < %= javascript_include_tag "prototype", "application", "foo", "bar", :cache => "cache/defaults" %>

Why do this?

Back to the front page