No commit activity in last 3 years
No release in over 3 years
Easily compile Handlebars template for use with Jekyll
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 1.0.0
 Project Readme

jekyll-handlebars

Basic Setup

Requirements

  • 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
  • handlebars compiles the templates
    • Since you already have node installed you just need to run npm -g install handlebars

Installation

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'

Usage

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 %}.

Improvements

  1. Include Handlebars to not force people to manually manage dependencies
  2. Add a md5 hash of the contents to the name for cache busting.
  3. Find a way to drop the dependency on node.js, to make it easier to setup