npm.io
0.0.1 • Published 8 years ago

browserify-html

Licence
ISC
Version
0.0.1
Deps
2
Size
3 kB
Vulns
1
Weekly
0
Stars
1

browserify-html 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'));
});

Keywords