Additional helper for handlebars, include template into template. Work similar to partials but with browserify
.
npm install --save-dev injectify injectify-include
Configure gulp
:
var gulp = require("gulp"),
browserify = require("browserify"),
source = require("vinyl-source-stream"),
require("injectify-include/inject");
gulp.task('js', function () {
var bundleStream = browserify('./src/index.js')
.transform(require("injectify"))
.bundle();
return bundleStream
.pipe(source('index.js'))
.pipe(gulp.dest('dist'));
});
In file ./src/index.js
require injectify include
helper:
require("injectify-include");
Now you can use include
helper in your templates:
include
helper works like original browserify require
. You can require modules relative to template file or
node_modules directory.
- Handlebars 3.0
- Injectify 2.0