Tilt::Handlebars
Adds support for Handlebars.rb template engine to Tilt.
See the Handlebars.js site for syntax.
Installation
Add this line to your application's Gemfile:
gem 'tilt-handlebars'
And then execute:
$ bundle
Or install it yourself as:
$ gem install tilt-
Usage
Create a Handlebars template file with either a .hbs or .handlebars extension.
Example, in hello.hbs:
Hello, {{name}}. I'm {{emotion}} to meet you.
Then, render the template with Ruby:
require 'tilt/handlebars'
template = Tilt.new('hello.hbs')
puts template.render(nil, name: "Joe", emotion: "happy")
Output:
Hello, Joe. I'm happy to meet you.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request