babel-html-inline
v1.0.4
Published
compiled inline javascript code with babel
Downloads
3
Maintainers
Readme
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));
});