Use namespaced helpers with handlebars.
npm install namespace-helpers> Use namespaced helpers with handlebars.
Install with npm
``sh`
$ npm i namespace-helpers --save
`js
var namespace = require('namespace-helpers');
var handlebars = require('handlebars');
var obj = {
foo: function(){},
bar: function(){},
baz: function(){}
};
var helpers = namespace('utils', obj);
// results in
// { 'utils.foo': [Function],
// 'utils.bar': [Function],
// 'utils.baz': [Function] }
// register with handlebars
handlebars.registerHelper(helpers);
`
Use in templates like this (namespaced helper names need to be quoted as string literals):
`handlebars`
{{"utils.foo" a}}
{{"utils.bar" b}}
{{"utils.baz" c}}
* create-frame: Easily add private variables to handlebars block helpers. | homepage
* handlebars-helpers: 120+ Handlebars helpers in ~20 categories, for Assemble, YUI, Ghost or any Handlebars project. Includes… more | homepage
* template-helpers: Generic JavaScript helpers that can be used with any template engine. Handlebars, Lo-Dash, Underscore, or… more | homepage
Install dev dependencies:
`sh``
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Jon Schlinkert
+ github/jonschlinkert
+ twitter/jonschlinkert
Copyright © 2015 Jon Schlinkert
Released under the MIT license.
*
_This file was generated by verb-cli on September 27, 2015._