No commit activity in last 3 years
No release in over 3 years
Tags assets in Rails app css files with asset query strings.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 3.0
 Project Readme

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