sprockets

https://github.com/rails/sprockets

Ruby

Rack-based asset packaging system

Sprockets::Processing#register_preprocessor

Registers a new Preprocessor `klass` for `mime_type`.

    register_preprocessor 'text/css', Sprockets::DirectiveProcessor

A block can be passed for to create a shorthand processor.

    register_preprocessor 'text/css' do |input|
      input[:data].gsub(...)
    end

Source | Google | Stack overflow

Edit

git clone [email protected]:rails/sprockets.git

cd sprockets

open lib/sprockets/processing.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Sprockets--Processing-register_preprocessor-for-pr


# Commit to git

git add lib/sprockets/processing.rbgit commit -m "better docs for Sprockets::Processing#register_preprocessor"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Sprockets--Processing-register_preprocessor-for-pr

hub pull-request


# Celebrate!