Bars-Browserify
A Browserify transform for Bars template files.
Installation
$ npm install bars-browserify
Usage
NodeJS register with require
require('bars-browserify').registerWithRequire({
extensions: ['.bars', '.whatever'],
mode: 'DOM',
flags: {
minify: true
}
});
Browserify Command Line
$ browserify -t bars-browserify myfile.js
Browserify Middleware
var browserify = require('browserify'),
barsBrowserify = require('bars-browserify');
var bundle = browserify()
.transform(barsBrowserify({
extensions: ['.bars', '.whatever'],
mode: 'DOM',
flags: {
minify: true
}
}))
.add('my_app_main.js');
app.use(bundle);
gulp and gulp-browserify
To incorporate bars-browserify into a gulp
build process using gulp-browserify
, register bars-browserify
as a transform as follows:
gulp.task('js', function() {
return gulp.src('src/main.js', { read: false })
.pipe(browserify({
transform: barsBrowserify({
extensions: ['.bars', '.whatever'],
mode: 'DOM',
flags: {
minify: true
}
})
}))
.pipe(gulp.dest(paths.build));
});