Sprockets Relative URL support

Fixes relative URLs in CSS assets using Sprockets.

Each asset is resolved from Sprockets, and its relative URL will be rewritten to use a precompiled version. By adding this preprocessor, CSS frameworks can be minified and combined into your application.css file without any need to rewrite the url() values in their CSS.

Tested with:

  • Rails
  • TODO: Sinatra

Installation

Add this line to your application's Gemfile:

gem 'sprockets_relative_url'

Usage

Rails

Add the processor to the Rails asset pipeline:

Rails.application.assets
  .register_postprocessor('text/css', SprocketsRelativeUrl::Processor)

Sinatra

TODO

Contributing

  1. Fork it ( https://github.com/smangelsdorf/sprockets_relative_url/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request