helper-require
v0.1.0
Published
Use any node module in templates. Should work with Handlebars, Lo-Dash, underscore, or any template engine that has support for helper functions.
Downloads
3
Readme
helper-require
Use any node module in templates. Should work with Handlebars, Lo-Dash, underscore, or any template engine that has support for helper functions.
Install with npm
npm i helper-require --save-dev
Usage
var helper = require('helper-require');
Usage with verb
If you use a .verb.md
, just add the helper to devDependencies
. If you use a verbfile.js
, you can register the helper like this:
verb.helper('require', require('helper-require'));
// usage
// {%= require('get-value')({a: {b: {c: 'foo'}}}, 'a.b.c') %}
// //=> 'foo'
Usage with assemble
assemble.helper('require', require('helper-require'));
// usage (pass {a: {b: {c: 'foo'}}} on the context)
// {{require, 'get-value' this 'a.b.c'}}
// //=> 'foo'
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
Jon Schlinkert
License
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb on February 08, 2015.