Registry / devops / gulp-html-minifier

gulp-html-minifier

JSON →
library0.1.8jsnpmunverified

Gulp plugin that minifies HTML using the html-minifier library. Version 0.1.8 is the latest stable release. The plugin wraps html-minifier's options, adding convenience features like ignorePath (to remove path segments from output) and an environment flag to skip minification in development. It is a legacy gulp plugin from the early gulp ecosystem, relying on gulp streams (not through2 or newer patterns). No longer actively maintained; consider using gulp-htmlmin or integrating html-minifier directly.

npm install gulp-html-minifier
INSTALL
IMPORT
SIG · GULP-HTML-MINIFIER
G
gulp-html-minifier
devopsjavascriptv0.1.8
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import htmlmin from 'gulp-html-minifier';
var htmlmin = require('gulp-html-minifier');
CommonJS require works, but ES default import is also valid. The module exports a single function.
named (none)
const htmlmin = require('gulp-html-minifier');
const { minify } = require('gulp-html-minifier');
No named exports; only default export.
gulp pipe usage
.pipe(htmlmin({ collapseWhitespace: true }))
.pipe(htmlmin().on('error', ...))
Options are passed directly to the function call, not via separate .minify() method.

Basic gulp task that minifies all HTML files with common html-minifier options and outputs to dist.

const gulp = require('gulp'); const htmlmin = require('gulp-html-minifier'); gulp.task('minify-html', () => { return gulp.src('src/**/*.html') .pipe(htmlmin({ removeComments: true, collapseWhitespace: true, removeAttributeQuotes: true, minifyJS: true, minifyCSS: true })) .pipe(gulp.dest('dist')); });
Debug
Known issues
deprecatedThis package is no longer maintained. Use gulp-htmlmin or html-minifier directly.
fix
Switch to 'gulp-htmlmin' (gulp plugin) or use html-minifier directly with through2.
affects: >=0
gotchaThe package does not support gulp v4's async completion. Tasks may not finish properly.
fix
Use gulp v3 or wrap the stream with `through2` and handle `end` event properly.
affects: >=0.1.8
gotchaOptions object includes 'env' to skip minification. Not all html-minifier options are exposed.
fix
Check html-minifier docs for all options; some may not be passed through.
affects: >=0.1.8
Errors
Common errors & fixes
Error: Cannot find module 'gulp-html-minifier'
Package not installed or misspelled.
fix
Run 'npm install gulp-html-minifier' (note hyphens).
TypeError: htmlmin is not a function
Using named import 'htmlmin' when it's a default export.
fix
Use 'const htmlmin = require('gulp-html-minifier');' or import default.
Upgrade
Version history
0.1.8latest on npm
Audit
Dependencies
gulprequiredPeer dependency for gulp plugin compatibility.
html-minifierrequiredCore minification engine.
Agent activity
4 hits · last 30 days
node
4
Resources
gulp-html-minifier — npm install gulp-html-minifier · libregistry