⚠ Warning This library is deprecated. The underlying libraries that this package relies on are either unmaintained or have security warnings. I'm deprecating this project until someone rewrites it with modern tooling.
Reads data, partials and helpers from asynchronous sources like a databases, file systems, or promises.
function getData() {
return Promise.resolve({contents: 'whatever'});
}
function getHelpers() {
return Promise.resolve({menu: function(options) { return 'menu!'; }});
}
function getPartials() {
return Promise.resolve({header: '<header></header>', footer: '<footer></footer>'});
}
gulp.src('./app/index.hbs')
.pipe(handlebars(getData(), {helpers: getHelpers(), partials: getPartials()}))
.pipe(gulp.dest('./dist'));
gulp.src('./app/index.hbs')
.pipe(handlebars({contents:"whatever"}, {
helpers: gulp.src('./app/helpers/**/*.js'),
partials: gulp.src('./app/partials/**/*.hbs')
}))
.pipe(gulp.dest('./dist'));
var MyHandlebars = handlebars.instance() // get Handlebars
handlebars.instance(MyHandlebars) // use another Handlebars instance
npm install gulp-static-handlebars
To run the basic tests, just run mocha
normally.
This assumes you've already installed the local npm packages with npm install
.
- Support more handlebars options