This gulp plugin is wrapper of htmlclean.
- Grunt plugin: grunt-htmlclean
- webpack loader: htmlclean-loader
If you want to just clean files, Command Line Tool is easy way.
Simple and safety HTML/SVG cleaner to minify without changing its structure.
See htmlclean for options and more information about htmlclean.
npm install gulp-htmlclean --save-dev
gulpfile.js
var gulp = require('gulp'),
htmlclean = require('gulp-htmlclean');
gulp.task('default', function() {
return gulp.src('./develop/*.html')
.pipe(htmlclean({
protect: /<\!--%fooTemplate\b.*?%-->/g,
edit: function(html) { return html.replace(/\begg(s?)\b/ig, 'omelet$1'); }
}))
.pipe(gulp.dest('./public_html/'));
});
See htmlclean for the options.