Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Tags assets in Rails app css files with asset query strings.
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
MIT-LICENSE
README.md
Rakefile
css_asset_tagger.gemspec

README.md

CssAssetTagger

Adds asset query strings to assets found in css files. This gem originated as a rails plugin well before the asset pipeline was part of rails. This plugin is still useful in Rails 3.1+ apps though if the asset pipeline is not enabled.

Install

In your Gemfile:
gem 'css_asset_tagger'

Example

Simply install the plugin and css files will be updated to include asset tags for any found assets.

before:
background: url("/images/background.png") repeat-x scroll 0 0 #ffffff;

after:
background: url(/images/background.png?1296473764) repeat-x scroll 0 0 #ffffff;

To modify the plugins behaviour, add an initializer file to config/initializers

  • perform_tagging - Flag to determine if the css files should be modified with asset tags.
    Defaults to tag in production only.
  • css_paths - An array of css stylesheet paths. Defaults to the main stylesheets path.
    Defaults to ["#{Rails.root}/public/stylesheets"]
  • asset_path - The main asset path to be used when looking for assets with absolute file references.
    Defaults to Rails.root.join('public')
  • show_warnings - Set to true to see warnings for assets that can't be found on the filesystem or false to not show the warnings.
    Defaults to showing warnings in dev mode only.

ex. config/initializers/css_tagger_options.rb

require 'css_asset_tagger_options'

CssAssetTaggerOptions.setup do |config|
  config.perform_tagging = true
end

Copyright (c) 2009-2013 Redline Software Inc., released under the MIT license

Something went wrong with that request. Please try again.