helper-lorem

0.1.1 • Public • Published

helper-lorem NPM version

Template helper for generator lorem-ipsum placeholder text. Should work with any template engine, but can also be used a regular javascript util.

Install

Install with npm

npm i helper-lorem --save

Run tests

npm test

Register the helper

This should work with any engine, here are a few examples

template

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

assemble

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

verb

verb.helper('lorem', require('helper-lorem'));

handlebars

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

Example usage

Handlebars:

// use default options
var template = Handlebars.compile('{{lorem}}');
var result = template();
 
// pass options on the context
var context = {count: 7, units: 'words'}
var template = Handlebars.compile('{{lorem this}}');
var result = template(context);
 
// pass options on the helper hash
var template = Handlebars.compile('{{lorem count="7" units="words"}}');
var result = template();

Lo-Dash or Underscore:

<!-- use default options -->
<%= lorem() %>
 
<!-- pass options on the context -->
<%= lorem({count: 7, units: 'words'}) %>

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

<!-- use default options -->
{%= lorem() %}
 
<!-- pass options on the context -->
{%= lorem({count: 7, units: 'words'}) %}

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert
Released under the MIT license


This file was generated by verb on November 11, 2014.

Dependents (1)

Package Sidebar

Install

npm i helper-lorem

Weekly Downloads

179

Version

0.1.1

License

none

Last publish

Collaborators

  • doowb
  • jonschlinkert