{%= description %}
{%= include("install-npm", {save: true}) %}
Easily create async helpers.
Example
var Template = require('template');
var template = new Template();
var helper = require('{%= name %}');
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: '[![Build Status](http://img.shields.io/travis/<%= name %>.svg)](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);
//=> '[![Build Status](http://img.shields.io/travis/verb.svg)](https://travis-ci.org/verb)'
done();
});
{%= related(['template', 'verb', 'assemble']) %}
{%= include("tests") %}
{%= include("contributing") %}
{%= include("author") %}
{%= copyright() %} {%= license() %}
{%= include("footer") %}