Skip to content

Latest commit

 

History

History
62 lines (47 loc) · 1.25 KB

README.md

File metadata and controls

62 lines (47 loc) · 1.25 KB

Themeleon Handlebars

Handlebars mixin for Themeleon.

Warning: this repository/package is deprecated, template engines will be handled by consolidate.js in Themeleon 3.0.

Installation

In your package.json:

{
  "dependencies": {
    "themeleon": "1.*",
    "themeleon-handlebars": "1.*"
  }
}

Usage

Say we have the following theme structure:

views/
  foo/
    bar.handlebars
  foo.handlebars
  index.handlebars
var themeleon = require('themeleon')();

// Use the Handlebars mixin
themeleon.use('handlebars');

// Or inject your own instance
themeleon.use('handlebars', require('handlebars'));

module.exports = themeleon(__dirname, function (t) {
  // Render index alone
  t.handlebars('views/index.handlebars', 'index.html');

  // Or include a partials object
  t.handlebars('views/index.handlebars', 'index.html', {
    foo: 'views/foo.handlebars',
    'foo/bar': 'views/foo/bar.handlebars',
  });

  // Or let the mixin resolve all `.handlebars` files in `views`
  // Note: `.handlebars` and `.hbs` extensions are supported.
  t.handlebars('views/index.handlebars', 'index.html', 'views');
});