JSPM

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

Handlebars engine, consolidate.js style but with enhancements. This works with Assemble, express.js, engine-cache or any application that follows consolidate.js conventions.

Package Exports

  • engine-handlebars

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

engine-handlebars NPM version

Handlebars engine, consolidate.js style but with enhancements. This works with Assemble, express.js, engine-cache or any application that follows consolidate.js conventions.

Install with npm

npm i engine-handlebars --save

Usage

var handlebars = require('engine-handlebars');

API

.compile

Handlebars string support. Compile the given str and register helpers and partials from settings

  • str {String}
  • settings {Object}: object containing optional helpers and partials
var engine = require('engine-handlebars');
var fn = engine.compile('{{name}}', {});

.render

Handlebars string support. Render the given str and invoke the callback cb(err, str).

  • str {String|function}
  • context {Object|Function}: or callback.
  • cb {Function}: callback function.
var engine = require('engine-handlebars');
engine.render('{{name}}', {name: 'Jon'}, function (err, content) {
  console.log(content); //=> 'Jon'
});

.renderSync

Synchronously render Handlebars templates.

  • str {Object|Function}: The string to render or compiled function.
  • context {Object}
  • returns {String}: Rendered string.
var engine = require('engine-handlebars');
engine.renderSync('<%= name %>', {name: 'Jon'});
//=> 'Jon'

.renderFile

Handlebars file support. Render a file at the given path and callback cb(err, str).

  • path {String}
  • options {Object|Function}: or callback function.
  • cb {Function}: callback function
var engine = require('engine-handlebars');
engine.renderSync('foo/bar/baz.tmpl', {name: 'Jon'});
//=> 'Jon'

Author

Jon Schlinkert

License

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


This file was generated by verb on February 19, 2015.