Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Template engine with handlebars.js extracted out of consolidate.js
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
MIT-LICENSE
Makefile
README.md
index.js
package.json

README.md

handlebars-engine

Template engine with handlebars.js extracted out of consolidate.js.

Disclaimer

All credit goes to consolidate.js and its contributors. Everything in here was extracted from there and nothing here includes any original work by me. The only difference here is that the template engine itself is exported.

Why

I wanted a handlebars.js template engine to use with express that was responsible for only handlebars.js and nothing else. I encountered no issues at all from consolidate.js which is why this does not include any extra features or a different implementation.

This was also a learning exercise for me to get a better understanding of consolidate.js's implementation.

Express 3.x Example

var express = require('express');
var handlebars = require('handlebars-engine');
// ...

app.engine('hbs', handlebars);
app.set('views', __dirname + '/views');
app.set('view engine', 'hbs');

// ...

app.get('/', function(req, res) {
  res.render('index', {
    name: 'Thor',
    partials: {
      header: 'header',
      footer: 'footer'
    },
    helpers: {
      yell: function(object) {
        return object + "!!";
      }
    }
  });
});

// ...

LICENSE

MIT

Something went wrong with that request. Please try again.