Skip to content

Latest commit

 

History

History
82 lines (59 loc) · 1.37 KB

.verb.md

File metadata and controls

82 lines (59 loc) · 1.37 KB

Usage

With Handlebars:

{{date "5 years ago" "YYYY"}}
//=> 2010

With Lo-Dash or Underscore:

<%= date("5 years ago", "YYYY") %>
//=> 2010

With Verb (lo-dash, with special delimiters to avoid delimiter collision in markdown docs):

{%= date('5 years ago', 'YYYY') %}
//=> 2010

[template][]

Register the helper for use with any template engine

template.helper('date', require('helper-date'));

[assemble]

To register the helper for use with [assemble] v0.6.0 and greater:

assemble.helper('date', require('helper-date'));

[verb]

Register the helper for use with [verb]:

var verb = require('verb');
verb.helper('date', require('helper-date'));

verb.task('default', function() {
  verb.src('.verb*.md')
    .pipe(verb.dest('./'));
});

[handlebars]

var handlebars = require('handlebars');
handlebars.registerHelper('date', require('helper-date'));

Usage

{{date "5 years ago" "YYYY"}}

[lodash] or [underscore]

// as a mixin
_.mixin({date: dateHelper});
_.template('<%= _.date("5 years ago", "YYYY") %>', {});
//=> 2010

// passed on the context
_.template('<%= date("5 years ago", "YYYY") %>', {date: dateHelper});
//=> 2010

// as an import
var settings = {imports: {date: dateHelper}};
_.template('<%= date("5 years ago", "YYYY") %>', {}, settings);
//=> 2010