Grease
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
When you'd like to use Tilt::HamlTemplate
in Sprockets, add code like this:
# Sprockets 3
register_engine ".haml", Grease.apply(Tilt::HamlTemplate), mime_type: Tilt::HamlTemplate.default_mime_type, silence_deprecation: true
# Sprockets 4 or later
register_mime_type "text/haml", extensions: %w(.haml .html.haml)
register_transformer "text/haml", Tilt::HamlTemplate.default_mime_type, Grease.apply(Tilt::HamlTemplate)
It works because Grease.apply
returns a "callable" object.
Contributing
You should follow the steps below.
- Fork the repository
- Create a feature branch:
git checkout -b add-new-feature
- Commit your changes:
git commit -am 'add new feature'
- Push the branch:
git push origin add-new-feature
- 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.