namespace-helpers
v0.1.0
Published
Use namespaced helpers with handlebars.
Downloads
166
Maintainers
Readme
namespace-helpers
Use namespaced helpers with handlebars.
Install
Install with npm
$ npm i namespace-helpers --save
Usage
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):
{{"utils.foo" a}}
{{"utils.bar" b}}
{{"utils.baz" c}}
Related projects
- 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
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Jon Schlinkert
License
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on September 27, 2015.