node
is required for running handlebars- If you are on a Mac and have brew installed, installing this is as easy as
brew install node
- If you are on a Mac and have brew installed, installing this is as easy as
handlebars
compiles the templates- Since you already have node installed you just need to run
npm -g install handlebars
- Since you already have node installed you just need to run
Install the gem
[sudo] gem install jekyll-handlebars
Then in a plugin file within your Jekyll project's _plugins
directory:
#_plugins/handlebars.rb
require 'rubygems'
require 'jekyll-handlebars'
or if you are using bundler just add:
gem 'jekyll-handlebars'
to your Gemfile. Create a plugin file that looks like this in you _plugins
directory:
#_plugins/handlebars.rb
require 'rubygems'
require 'bundler/setup'
require 'jekyll-handlebars'
Make a directory for handlebars templates _assets/templates
. All of your templates should end
with .template
. You'll also have to manually include the handlebars runtime
(direct link) in your layouts. After the runtime, include the liquid tag for your template. If
your template is example.template
the liquid tag will be {% template example %}
.
- Include Handlebars to not force people to manually manage dependencies
- Add a md5 hash of the contents to the name for cache busting.
- Find a way to drop the dependency on node.js, to make it easier to setup