Socket
Book a DemoInstallSign in
Socket

handlebars-helper-each

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handlebars-helper-each

Handlebars each helper, sync and async.

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

handlebars-helper-each NPM version NPM monthly downloads NPM total downloads Linux Build Status

Handlebars each helper, sync and async.

Install

Install with npm:

$ npm install --save handlebars-helper-each

Usage

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.

var assemble = require('assemble');
var app = assemble();

// register the helper
app.helper('each', require('handlebars-helper-each'));

// add some views
app.page('foo.html', {content: 'this is foo', data: {title: 'Foo'}});
app.page('bar.html', {content: 'this is bar', data: {title: 'Bar'}});
app.page('baz.html', {content: 'this is baz', data: {title: 'Baz'}});

Then add another template with something like the following:

<ul>
{{#pages}}
  {{#each items as |view|}}
  <!-- "item" is view (vinyl file), so you can 
  get any file properties you need -->
  <li><a href="{{item.path}}">{{item.data.title}}</a></li>
  {{/each}}
{{/pages}}
</ul>

Renders to:

<ul>
  <li><a href="foo.html">Foo</a></li>
  <li><a href="bar.html">Bar</a></li>
  <li><a href="baz.html">Baz</a></li>
</ul>

About

  • assemble: Get the rocks out of your socks! Assemble makes you fast at creating web projects… more | homepage
  • handlebars-helpers: More than 130 Handlebars helpers in ~20 categories. Helpers can be used with Assemble, Generate… more | homepage
  • template-helpers: Generic JavaScript helpers that can be used with any template engine. Handlebars, Lo-Dash, Underscore, or… more | homepage

Contributing

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.

Building docs

(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:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Install dev dependencies:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT license.

This file was generated by verb-generate-readme, v0.4.1, on January 25, 2017.

Keywords

assemble

FAQs

Package last updated on 25 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts