We’ve released a new plugin for Rails that adds asset timestamps to assets found in an apps stylesheets.
The plugin is available at http://github.com/redlinesoftware/css_asset_tagger
Simply install the plugin and it will tag any assets in your css files with asset timestamps. More information on asset timestamps can be found at http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html
We wrote a previous article on using asset timestamps with nginx, but similar usage applies to Apache as well for example.
The main purpose for writing this plugin is that stylesheets that use images for various things don’t get tagged with the asset timestamps when they’re written as plain old css files. These images can’t make use of expiration techniques very easily without the timestamps. So to make things work as they do with images in rails views, this plugin will add the same timestamps to assets in css files as they are in rails views.
Before…
1 2 3 |
|
After…
1 2 3 |
|
If you’re using yslow and some decent expiration on the server and you don’t like seeing images from your css files being shown in your report card, this plugin should make those all go away and hopefully give you a better grade. :)