0.0.1 • Published 6 years ago

browserify-html v0.0.1

Weekly downloads
44
License
ISC
Repository
github
Last release
6 years ago

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