Skip to content

Handlebars engine, consolidate.js style but with enhancements and default helpers. This works with Assemble, express.js, engine-cache or any application that follows consolidate.js conventions.

License

Notifications You must be signed in to change notification settings

kapooostin/engine-assemble

 
 

Repository files navigation

engine-assemble NPM version Build Status

Handlebars engine, consolidate.js style but with enhancements and default helpers. Should work with Assemble, Verb, express.js, engine-cache or any application that supports consolidate.js conventions.

Wrapper around engine-handlebars and handlebars-helpers to provide a default template engine for Assemble.

Install with npm

npm i engine-assemble --save

Usage

var engine = require('engine-assemble');

API

Handlebars compile support. Compile the given str, register helpers and partials from settings and return a function.

  • str {String}
  • settings {Object}: object containing optional helpers and partials
  • returns {Function}: Compiled template function
var engine = require('engine-assemble');
var fn = engine.compile('{{name}}', {});

Handlebars string support. Render the given str and invoke the callback cb(err, str).

  • str {String}
  • options {Object|Function}: or callback.
  • cb {Function}: callback function.
var engine = require('engine-assemble');
engine.render('{{name}}', {name: 'Jon'}, function (err, content) {
  console.log(content); //=> 'Jon'
});

Handlebars sync support. Synchronously render Handlebars templates.

  • str {Object}: The string to render.
  • options {Object}: Object of options.
  • returns {String}: Rendered string.
var engine = require('engine-assemble');
engine.renderSync('<%= name %>', {name: 'Jon'});
//=> 'Jon'

Handlebars file support. Render a file at the given filepath and callback cb(err, str).

  • filepath {String}
  • options {Object|Function}: or callback function.
  • cb {Function}: callback function
var engine = require('engine-assemble');
engine.renderSync('foo/bar/baz.tmpl', {name: 'Jon'});
//=> 'Jon'

Author

Brian Woodward

License

Copyright (c) 2015 Brian Woodward
Released under the MIT license


This file was generated by verb-cli on March 12, 2015.

About

Handlebars engine, consolidate.js style but with enhancements and default helpers. This works with Assemble, express.js, engine-cache or any application that follows consolidate.js conventions.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%