Package Exports
- template-bind-helpers
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (template-bind-helpers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
template-bind-helpers

Bind the current instance of a Templates-based application to an object of helpers, allowing them to be passed to a different render method.
Install
Install with npm
$ npm i template-bind-helpers --save
Usage
bindHelpers
Bind helper functions to app
so that, when the helper is called, the this
keyword is set to the provided instance of app
.
Params
app
{Object}: Instance of any [Templates-based][templates] application, such as verb, assemble or generateview
{Object}: The view being compiled or renderedlocals
{Object}: Context object with helpers to bind. This is usually theoptions
object.isAsync
{Boolean}returns
{Object}
Example
var bindHelpers = require('{%= name %}');
var str = '<%= replace("foo", "bar") %>';
opts = bindHelpers(this.app, opts, true);
// pass opts to a render method as context
app.render(str, opts, function(err, result) {
console.log(result);
});
Related projects
- async-helpers: Use async helpers in templates with engines that typically only handle sync helpers. Handlebars and… more | homepage
- engine-cache: express.js inspired template-engine manager. | homepage
- helper-cache: Easily register and get helper functions to be passed to any template engine or node.js… 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 on December 11, 2015.