patternengine-node-handlebars-extended

1.0.0 • Public • Published

The Extended Handlebars engine for Pattern Lab 2 / Node

To install the Handlebars engine in your edition, npm install patternengine-node-handlebars-extended should do the trick.

By adding patternlab-handlebars-config.js to your project root you may extend the Handlebars instance:

module.exports = function (Handlebars) {
  /*
  Register a Helper called `list` which lets you pass values between patterns:

  Examples:
  {{>partialName class=(list classNames)}}
  {{>partialName class=(list 'closs-one class-two')}}
  {{>partialName class=(list 'closs-one' 'class-two')}}
  */
  Handlebars.registerHelper('list', (...args) => {
    args.pop(); // pop options
    const a = [];
    return a.concat.apply(a, args);
  });
};

Supported features

/patternengine-node-handlebars-extended/

    Package Sidebar

    Install

    npm i patternengine-node-handlebars-extended

    Weekly Downloads

    4

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    9.62 kB

    Total Files

    8

    Last publish

    Collaborators

    • engelfrost