JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1940
  • Score
    100M100P100Q125086F
  • License MIT

The Handlebars engine for Pattern Lab / Node

Package Exports

  • @pattern-lab/engine-handlebars
  • @pattern-lab/engine-handlebars/lib/engine_handlebars.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@pattern-lab/engine-handlebars) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

The Handlebars PatternEngine for Pattern Lab / Node

To install the Handlebars PatternEngine in your edition, npm install --save @pattern-lab/engine-handlebars should do the trick.

Supported features

Helpers

To add custom helpers or otherwise interact with Handlebars directly, create a file named patternlab-handlebars-config.js in the root of your Pattern Lab project, or override the default location by specifying one or several glob patterns in the Pattern Lab config:

  {
    ...
    "engines": {
      "handlebars": {
        "extend": [
          "handlebars-helpers.js",
          "helpers/**/*.js"
        ]
      }
    }
  }

Each file should export a function which takes Handlebars as an argument.

module.exports = function(Handlebars) {
  // Put helpers here

  Handlebars.registerHelper('fullName', function(person) {
    // Example: person = {firstName: "Alan", lastName: "Johnson"}
    return person.firstName + " " + person.lastName;
  });
};