Skip to content

redlinesoftware/css_asset_tagger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Tags assets in Rails app css files with asset query strings.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages