Name: handlebars-helper-each
Owner: Helpers
Description: Handlebars each helper, can be used as a sync helper with any handlebars project (as normal) or as an async helper with assemble or libs that support async helpers.
Created: 2017-01-25 14:14:41.0
Updated: 2017-08-16 20:19:16.0
Pushed: 2017-01-25 19:33:54.0
Homepage: null
Size: 11
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Handlebars each helper, sync and async.
Install with npm:
m install --save handlebars-helper-each
You can use this helper synchronously with any handlebars application. To use it asynchronously you'll need to use a templates-based application. This example shows how to use the helper with assemble.
assemble = require('assemble');
app = assemble();
egister the helper
helper('each', require('handlebars-helper-each'));
dd some views
page('foo.html', {content: 'this is foo', data: {title: 'Foo'}});
page('bar.html', {content: 'this is bar', data: {title: 'Bar'}});
page('baz.html', {content: 'this is baz', data: {title: 'Baz'}});
Then add another template with something like the following:
ages}}
#each items as |view|}}
-- "item" is view (vinyl file), so you can
t any file properties you need -->
i><a href="{{item.path}}">{{item.data.title}}</a></li>
/each}}
ages}}
>
Renders to:
i><a href="foo.html">Foo</a></li>
i><a href="bar.html">Bar</a></li>
i><a href="baz.html">Baz</a></li>
>
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Please read the contributing guide for advice on opening issues, pull requests, and coding standards.
(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)
To generate the readme, run the following command:
m install -g verbose/verb#dev verb-generate-readme && verb
Install dev dependencies:
m install && npm test
Jon Schlinkert
Copyright © 2017, Jon Schlinkert. Released under the MIT license.
This file was generated by verb-generate-readme, v0.4.1, on January 25, 2017.