Skip to content

Latest commit

 

History

History
75 lines (50 loc) · 1.46 KB

.verb.md

File metadata and controls

75 lines (50 loc) · 1.46 KB

{%= name %} {%= badge("fury") %}

{%= description %}

{%= include("install-npm", {save: true}) %}

Usage

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 projects

{%= related(['template', 'verb', 'assemble']) %}

Running tests

{%= include("tests") %}

Contributing

{%= include("contributing") %}

Author

{%= include("author") %}

License

{%= copyright() %} {%= license() %}


{%= include("footer") %}