Handlebars block helper that adds variables to the context that can be used by following expressions in the same template.
Install with npm
npm i handlebars-helper-variable --save
var variable = require('handlebars-helper-variable');
Dyanimcally add JSON objects to the context.
context
{Object}: Context object to put the JSON object on.
Register the helper with Handlebars
var variable = require('handlebars-helper-variable');
var context = {};
Handlebars.registerHelper('variable', variable(context));
Use the helper in a Handlebars template.
Compile and render the template with the given context.
Handlebars.compile(template)(context);
//=> context = { foo: { foo: 'bar' } }
Install dev dependencies:
npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Brian Woodward
Copyright (c) 2015 Brian Woodward
Released under the MIT license
This file was generated by verb-cli on March 20, 2015.