gulp-htmlmin npm package of node.js


Overview

This is a plugin for gulp which is used to minify the html files.

Code


													
var gulp = require('gulp');
var htmlmin = require('gulp-htmlmin');

gulp.task('minify', function() {
  return gulp.src('source/*.html')
    .pipe(htmlmin({collapseWhitespace: true}))
    .pipe(gulp.dest('dist'));
});
													
												

Run

  • Now run the snippet using the following command :
    													
    $gulp minify