Registry / testing / gulp-mini-htmlmin

gulp-mini-htmlmin

JSON →
library1.0.2jsnpmunverified

A Gulp plugin to minify HTML files using html-minifier. At version 1.0.2 (latest), it wraps html-minifier and supports all its options (e.g., collapseWhitespace, removeComments). The package has been stable since 2017 with no recent updates. It requires Node >= 4.0. Compared to alternatives like gulp-minify-html, this plugin uses a more widely maintained minifier backend. However, note that the repository is archived and no longer maintained; users should consider forked or alternative plugins.

npm install gulp-mini-htmlmin
INSTALL
IMPORT
SIG · GULP-MINI-HTMLMIN
G
gulp-mini-htmlmin
testingjavascriptv1.0.2
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.

htmlmin
var htmlmin = require('gulp-htmlmin');
const htmlmin = require('gulp-htmlmin').default;
The plugin uses a CommonJS module.exports, so no .default needed.
gulp
var gulp = require('gulp');
import gulp from 'gulp';
Gulp 3.x uses CommonJS; for Gulp 4+ you can use ESM but requires gulp@4 and Node >=12.
htmlmin (ESM)
import htmlmin from 'gulp-htmlmin';
import { htmlmin } from 'gulp-htmlmin';
As of version 1.0.2, the package does not ship native ESM; this import works only with bundlers like webpack or when using esm transpilation.

Basic Gulp task using gulp-htmlmin to minify HTML files with whitespace collapse and comment removal.

var gulp = require('gulp'); var htmlmin = require('gulp-htmlmin'); gulp.task('minify', function() { return gulp.src('src/*.html') .pipe(htmlmin({ collapseWhitespace: true, removeComments: true })) .pipe(gulp.dest('dist')); }); gulp.task('default', ['minify']);
Debug
Known issues
deprecatedThe repository is archived and no longer maintained.
fix
Consider using gulp-html-minifier-terser or other actively maintained plugins.
affects: >=0.0.0
gotchaOptions are passed directly to html-minifier; some options may have unexpected defaults or be ignored without warning.
fix
Refer to html-minifier documentation and test outputs thoroughly.
affects: >=0.0.0
gotchaRequires Gulp 3.x; compatibility with Gulp 4 may require use of gulp.series() and gulp.parallel().
fix
Upgrade to gulp@4 and adjust task definitions.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'gulp-htmlmin'
Package not installed or incorrectly required.
fix
Run `npm install --save-dev gulp-htmlmin` and ensure the require path is correct.
TypeError: htmlmin is not a function
Using ES6 import incorrectly (e.g., named import or .default).
fix
Use `var htmlmin = require('gulp-htmlmin');` or `import htmlmin from 'gulp-htmlmin';`.
The following tasks did not complete: <task>
Gulp 3 style task registration didn't finish or async issue.
fix
For Gulp 4, use `exports.minify = minify;` or `gulp.task('minify', minify);` with proper async handling.
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies
html-minifierrequiredCore minification engine; all options are passed through.
gulprequiredPeer dependency; required to use the plugin.
Agent activity
4 hits · last 30 days
node
4
Resources
gulp-mini-htmlmin — npm install gulp-mini-htmlmin · libregistry