browserify-html
v0.0.1
Published
Makes HTML files usuable as modules in Browserify
Downloads
111
Maintainers
Readme
browserify-html
Simple HTML transform for Browserify
npm i browserify-html
Options
- exts - default:
['html', 'tpl']
- minify - default:
{removeComments: true, collapseWhitespace: true, collapseBooleanAttributes: true, removeRedundantAttributes: true, removeEmptyAttributes: true}
, see html-minifier
Usage
const html = require('browserify-html');
Browserify Middleware
const bunlde = browserify()
.transform(html, {
exts: ['html', 'tpl'], // default
minify: { // html-minifier options, see more: https://github.com/kangax/html-minifier#options-quick-reference
removeComments: true,
collapseWhitespace: true,
collapseBooleanAttributes: true,
removeRedundantAttributes: true,
removeEmptyAttributes: true
}
});
Gulp and Browserify
gulp.task('js', () => {
return gulp.src('./src/js/app.js')
.pipe(browserify({
transform: html
}))
.pipe(gulp.dest('./dist/js'));
});