$ npm install async-helper-baseUsed for creating template.js-compatible async helpers. Works with verb, assemble or any other template.js application.
npm i async-helper-base --save
Easily create async helpers.
Example
var Template = require('template');
var template = new Template();
var helper = require('async-helper-base');
Create a custom async helper
pass the instance of template to create the arbitrarily-named badge helper.
template.asyncHelper('badge', helper(template)('badge'));
Create a custom template type
template.create('badge');
Load badge templates
When we created the badge template type, a new .badge() method was created for loading templates. Let's use that now:
// one at a time
template.badge('travis', {content: '[](https://travis-ci.org/<%= name %>)'});
// or a glob
template.badges('foo/*.md');
Render the template
Last, render the template using the custom badge helper created from this lib:
template.render('<%= badge("travis") %>', {name: 'verb'}, function (err, res) {
if (err) console.log(err);
//=> '[](https://travis-ci.org/verb)'
done();
});
Install dev dependencies:
npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright (c) 2015 Jon Schlinkert
Released under the MIT license
This file was generated by verb-cli on April 19, 2015.