Grease

Gem Version Build Status Code Climate Test Coverage

Grease provides an adapter to use Tilt as extension of Sprockets 3 or later.

Installation

Add this line to your application's Gemfile:

gem "grease"

And then execute:

$ bundle

Or install it yourself as:

$ gem install grease

Usage

If you'd like to use Tilt::HamlTemplate in Sprockets, add code like this:

# Sprockets 3
register_engine ".haml", Grease.apply(Tilt::HamlTemplate), mime_type: "text/html", silence_deprecation: true

# Sprockets 4+
register_mime_type "text/haml", extensions: %w(.haml .html.haml)
register_transformer "text/haml", "text/html", Grease.apply(Tilt::HamlTemplate)

It works because Grease.apply returns a "callable" object.

Contributing

You should follow the steps below.

  1. Fork the repository
  2. Create a feature branch: git checkout -b add-new-feature
  3. Commit your changes: git commit -am 'add new feature'
  4. Push the branch: git push origin add-new-feature
  5. Send us a pull request

We use Appraisal to test with different versions of Sprockets.

bundle install
appraisal install

# Run rspec with a specific version of Sprockets
appraisal sprockets4 rspec

# Run rspec with all versions of Sprockets
appraisal rspec

License

The gem is available as open source under the terms of the MIT License.