Simple and safety HTML/SVG cleaner to minify without changing its structure.


Keywords
gulpplugin, html, svg, clean, whitespace, linebreak, comment, minify, compress, lightweight, gulp, javascript, unneeded-whitespaces
License
MIT
Install
npm install gulp-htmlclean@2.7.22

Documentation

gulp-htmlclean

npm GitHub issues David license

This gulp plugin is wrapper of htmlclean.

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.

Getting Started

npm install gulp-htmlclean --save-dev

Usage

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.