engine-assemble
v0.4.1
Published
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.
Downloads
217
Readme
engine-assemble
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
.compile
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 partialsreturns
{Function}: Compiled template function
var engine = require('engine-assemble');
var fn = engine.compile('{{name}}', {});
.render
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'
});
.renderSync
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'
.renderFile
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.