{"id":41197,"library":"gulp-html-minifier2","title":"gulp-html-minifier2","description":"A Gulp plugin wrapper around the html-minifier library for minifying HTML files. Version 1.1.11 is the latest stable release as of 2021, with minimal updates since 2016. It supports collapsing whitespace, removing comments, and other html-minifier options. The plugin adds convenience features like `ignorePath` to strip prefixes from file paths and `env` option to disable minification in development. It is a fork of the original gulp-html-minifier, providing compatibility with newer Gulp versions.","status":"maintenance","version":"1.1.11","language":"javascript","source_language":"en","source_url":"https://github.com/sapics/gulp-html-minifier2","tags":["javascript","gulpplugin","html","html minifier","html minify","minify"],"install":[{"cmd":"npm install gulp-html-minifier2","lang":"bash","label":"npm"},{"cmd":"yarn add gulp-html-minifier2","lang":"bash","label":"yarn"},{"cmd":"pnpm add gulp-html-minifier2","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"core minification engine","package":"html-minifier","optional":false},{"reason":"Gulp plugin error handling","package":"plugin-error","optional":false},{"reason":"stream transformation","package":"through2","optional":false}],"imports":[{"note":"The package does not export ESM, so use CommonJS require.","wrong":"import htmlmin from 'gulp-html-minifier2';","symbol":"gulp-html-minifier2","correct":"const htmlmin = require('gulp-html-minifier2');"},{"note":"The package exports a single function, not a named export.","wrong":"const { htmlmin } = require('gulp-html-minifier2');","symbol":"default export","correct":"const htmlmin = require('gulp-html-minifier2');"},{"note":"No official TypeScript types; use require and possibly install community types.","wrong":"import htmlmin from 'gulp-html-minifier2';","symbol":"TypeScript usage","correct":"const htmlmin = require('gulp-html-minifier2');\n// No type definitions; use @types/gulp-html-minifier2 if available"}],"quickstart":{"code":"const gulp = require('gulp');\nconst htmlmin = require('gulp-html-minifier2');\n\ngulp.task('minify', function() {\n  return gulp.src('./src/*.html')\n    .pipe(htmlmin({collapseWhitespace: true}))\n    .pipe(gulp.dest('./dist'));\n});","lang":"javascript","description":"Basic Gulp task that minifies HTML files from src to dist using html-minifier with collapsed whitespace."},"warnings":[{"fix":"Check documentation for extra options like ignorePath and env.","message":"Package is a fork and may have slight behavioral differences from the original gulp-html-minifier.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Migrate to gulp-htmlmin or another actively maintained plugin that uses a maintained minifier.","message":"The underlying html-minifier library is no longer actively maintained; consider alternatives like html-minifier-terser.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Do not pass {env: 'development'} in production tasks.","message":"The 'env' option in options disables minification entirely; ensure it is not accidentally set to 'development' in production.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Verify the expected output paths when using ignorePath.","message":"The 'ignorePath' option strips the given path prefix from relative file paths; may cause unexpected output paths if not used correctly.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.1.11':20 '2016':33 '2021':28 'add':48 'around':9 'collaps':36 'comment':39 'compat':79 'conveni':49 'develop':66 'disabl':63 'env':60 'featur':50 'file':18,57 'fork':70 'gulp':2,6,75,82 'gulp-html-minifi':74 'gulp-html-minifier2':1 'gulpplugin':85 'html':3,12,17,43,76,86,87,89 'html-minifi':11,42 'ignorepath':52 'javascript':84 'latest':23 'librari':14 'like':51 'minif':64 'minifi':13,16,44,77,88,90,91 'minifier2':4 'minim':30 'newer':81 'option':45,61 'origin':73 'path':58 'plugin':7,47 'prefix':55 'provid':78 'releas':25 'remov':38 'sinc':32 'stabl':24 'strip':54 'support':35 'updat':31 'version':19,83 'whitespac':37 'wrapper':8","created_at":"2026-06-04T18:51:14.715263+00:00","updated_at":"2026-06-04T18:51:14.715263+00:00","problems":[{"fix":"Run 'npm install gulp-html-minifier2 --save-dev'","cause":"Package not installed","error":"Error: Cannot find module 'gulp-html-minifier2'"},{"fix":"Change to 'const htmlmin = require('gulp-html-minifier2');'","cause":"Incorrect import: using named destructuring","error":"TypeError: htmlmin is not a function"},{"fix":"Add 'return' before gulp.src()","cause":"Gulp 4 requires a returned stream","error":"Error: Task 'minify' is not a function"}],"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":"https://github.com/sapics/gulp-html-minifier2","github":"https://github.com/sapics/gulp-html-minifier2","docs":null,"changelog":null,"pypi":null,"npm":"gulp-html-minifier2","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}}