{"id":41199,"library":"gulp-htmlmin-next","title":"gulp-htmlmin","description":"Gulp plugin to minify HTML using the popular html-minifier library. Current stable version is 6.0.1, with a release cadence that appears to be low (last major release October 2017). It passes through HTML files via Gulp pipeline and supports all options of the underlying html-minifier. Compared to alternatives like gulp-minify-html, gulp-htmlmin has the same API and has been more actively maintained in the past, though it relies on an older html-minifier. This package is ideal for optimizing HTML in a Gulp workflow, reducing file size with options like collapseWhitespace, removeComments, and minifyJS.","status":"maintenance","version":"6.0.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","format","gulp","gulpplugin","htm","html","htmlmin","minification","minifier"],"install":[{"cmd":"npm install gulp-htmlmin-next","lang":"bash","label":"npm"},{"cmd":"yarn add gulp-htmlmin-next","lang":"bash","label":"yarn"},{"cmd":"pnpm add gulp-htmlmin-next","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core library for HTML minification; gulp-htmlmin wraps html-minifier.","package":"html-minifier","optional":false},{"reason":"Required for handling errors in Gulp plugins.","package":"plugin-error","optional":false},{"reason":"Used to create transform streams for Gulp.","package":"through2","optional":false}],"imports":[{"note":"Default export is the plugin function.","wrong":"const htmlmin = require('gulp-htmlmin').default;","symbol":"default","correct":"import htmlmin from 'gulp-htmlmin';"},{"note":"CommonJS require returns the function directly.","wrong":null,"symbol":"require","correct":"const htmlmin = require('gulp-htmlmin');"},{"note":"TypeScript users should import types from html-minifier, not from gulp-htmlmin.","wrong":"import type { Options } from 'gulp-htmlmin';","symbol":"gulp-htmlmin type import","correct":"import type { Options } from 'html-minifier';"}],"quickstart":{"code":"const gulp = require('gulp');\nconst htmlmin = require('gulp-htmlmin');\n\ngulp.task('minify', () => {\n  return gulp.src('src/*.html')\n    .pipe(htmlmin({ collapseWhitespace: true, removeComments: true }))\n    .pipe(gulp.dest('dist'));\n});","lang":"javascript","description":"Basic Gulp task that minifies all HTML files from src/ to dist/ with collapseWhitespace and removeComments options."},"warnings":[{"fix":"Switch to a maintained fork like gulp-html-minifier-terser.","message":"Package gulp-htmlmin is deprecated; use gulp-html-minifier-terser or gulp-htmlmin2.","severity":"deprecated","affected_versions":">=6.0.0"},{"fix":"Consider using a forked plugin that uses a newer html-minifier version.","message":"html-minifier version pinned: gulp-htmlmin 6.0.1 depends on html-minifier ^3.5.8, which may have bugs not fixed.","severity":"gotcha","affected_versions":"6.0.1"},{"fix":"Open issues at https://github.com/kangax/html-minifier/issues","message":"Do not report HTML parsing issues to this repo; they should be reported to html-minifier.","severity":"gotcha","affected_versions":"all"},{"fix":"Enable minifyJS or use a separate JS minifier plugin.","message":"ECMAScript 6 features in minification (e.g., arrow functions) require setting `minifyJS: true` in options.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'2017':34 '6.0.1':20 'activ':72 'altern':55 'api':67 'appear':26 'cadenc':24 'collapsewhitespac':103 'compar':53 'current':16 'file':39,98 'format':108 'gulp':2,4,41,58,62,95,109 'gulp-htmlmin':1,61 'gulp-minify-html':57 'gulpplugin':110 'htm':111 'html':8,13,38,51,60,84,92,112 'html-minifi':12,50,83 'htmlmin':3,63,113 'ideal':89 'javascript':107 'last':30 'librari':15 'like':56,102 'low':29 'maintain':73 'major':31 'minif':114 'minifi':7,14,52,59,85,115 'minifyj':106 'octob':33 'older':82 'optim':91 'option':46,101 'packag':87 'pass':36 'past':76 'pipelin':42 'plugin':5 'popular':11 'reduc':97 'releas':23,32 'reli':79 'removecom':104 'size':99 'stabl':17 'support':44 'though':77 'under':49 'use':9 'version':18 'via':40 'workflow':96","created_at":"2026-06-04T18:51:15.490033+00:00","updated_at":"2026-06-04T18:51:15.490033+00:00","problems":[{"fix":"Use `import htmlmin from 'gulp-htmlmin'` with a bundler that supports CJS interop, or use require.","cause":"Using ES6 import syntax without correct CJS interop in older Node versions.","error":"Error: Module 'gulp-htmlmin' does not export default"},{"fix":"Use `const htmlmin = require('gulp-htmlmin');` or `import htmlmin from 'gulp-htmlmin';` if using ES modules.","cause":"Importing the module incorrectly (e.g., calling require('gulp-htmlmin').default when it's the default export).","error":"TypeError: htmlmin is not a function"},{"fix":"Ensure the task function returns a stream: `return gulp.src(...)`.","cause":"Gulp 4 changed task registration; using gulp.task with arrow function may not return stream.","error":"AssertionError [ERR_ASSERTION]: Task function must be specified"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"gulp-htmlmin-next","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}