babel-html-inline

1.0.4 • Public • Published

babel-html-inline

compiler inline javascript with Babel and uglify

Install

Using npm:

npm i -D babel-html-inline

or using yarn:

yarn add -D babel-html-inline

##options

key value
needUglify boolean (default false)

Using

require packages

const
    gulp        = require('gulp'),
    babelHtml   = require('babel-html-inline'),
    htmlMin     = require('gulp-htmlmin');

create task

//only babel in Html
gulp.task('babelHtml', () =>
    gulp.src([srcDir + '/**/*.html'])
        .pipe(babelHtml(options))
        .pipe(gulp.dest(targetDir))
);

//used with html-min
gulp.task('htmlMin', function () {
    let minOptions = {
        removeComments: true,
        collapseWhitespace: true,
        collapseBooleanAttributes: false,
        removeEmptyAttributes: false,
        removeScriptTypeAttributes: true,
        removeStyleLinkTypeAttributes: true,
        minifyJS: true,
        minifyCSS: true
    };
    gulp.src([srcDir + '/**/*.html'])
        .pipe(babelHtml())
        .pipe(htmlMin(minOptions))
        .pipe(gulp.dest(targetDir));
});

Package Sidebar

Install

npm i babel-html-inline

Weekly Downloads

7

Version

1.0.4

License

MIT

Unpacked Size

2.34 kB

Total Files

3

Last publish

Collaborators

  • xpfei