🚀 Launch Week Day 2:Introducing Custom Tabs for Org Alerts.Learn More →
Socket
Book a DemoInstallSign in
Socket

handlebars-helper-variable

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handlebars-helper-variable

Handlebars block helper that adds variables to the context that can be used by following expressions in the same template.

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
2
Created
Source

handlebars-helper-variable NPM version Build Status

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

Usage

var variable = require('handlebars-helper-variable');

API

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.

{{#variable "foo"}}
  { "foo": "bar" }
{{/variable}}

Compile and render the template with the given context.

Handlebars.compile(template)(context);
//=> context = { foo: { foo: 'bar' } }

Run 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

Brian Woodward

License

Copyright (c) 2015 Brian Woodward
Released under the MIT license

This file was generated by verb-cli on March 20, 2015.

FAQs

Package last updated on 21 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts