Class | Juicer::CssCacheBuster |
In: |
lib/juicer/css_cache_buster.rb
|
Parent: | Object |
The CssCacheBuster is a tool that can parse a CSS file and substitute all referenced URLs by a URL appended with a timestamp denoting it‘s last change. This causes the URLs to be unique every time they‘ve been modified, thus facilitating using a far future expires header on your web server.
See Juicer::CacheBuster for more information on how the cache buster URLs work.
When dealing with CSS files that reference absolute URLs like /images/1.png you must specify the :document_root option that these URLs should be resolved against.
When dealing with full URLs (ie including hosts) you can optionally specify an array of hosts to recognize as "local", meaning they serve assets from the :document_root directory. This way even asset host cycling can benefit from cache busters.