gulp-handlebars-builder
Forked from gulp-template Inspired by grunt-compile-handlebars Forged again (due to inactivity) from gulp-compile-handlebars
Compile Handlebars templates
Install
Install with npm
npm install --save-dev gulp-handlebars-builder
Example
src/hello.handlebars
{{> header}}<p>Hello {{firstName}}</p><p>HELLO! {{capitals firstName}}</p>{{> footer}}
src/partials/header.handlebars
<h1>Header</h1>
gulpfile.js
var gulp = ;var handlebars = ;var rename = ; gulp;
dist/hello.html
HeaderHello KaanonHELLO! KAANONthe end
Options
- ignorePartials : ignores any unknown partials. Useful if you only want to handle part of the file
- partials : Javascript object that will fill in partials using strings
- batch : Javascript array of filepaths to use as partials
- helpers: javascript functions to stand in for helpers used in the handlebars files
- compile: compile options. See handlebars reference for possible values
handlebars.Handlebars
You can access the Handlebars library from the handlebars.Handlebars
property.
var handlebars = ;var safestring = '<strong>HELLO! KAANON</strong>';
Works with gulp-data
Use gulp-data to pass a data object to the template based on the handlebars file being processed. If you pass in template data this will be extended with the object from gulp-data.
See gulp-data for usage examples.
Version History
1.0.0
Initial forked version, fixed gulp-util dependency issue