Registry / devops / connect-html-minifier

connect-html-minifier

JSON →
library0.1.0jsnpmunverified

HTML minifier middleware for Connect/Express that automatically minifies HTML responses on the fly. Version 0.1.0 wraps kangax/html-minifier to provide configurable minification options directly as Connect middleware. Lightweight and simple to integrate, but unmaintained since 2015 with no recent releases. Alternatives include middleware like express-minify-html or direct use of html-minifier-terser.

npm install connect-html-minifier
INSTALL
IMPORT
SIG · CONNECT-HTML-MINIF
C
connect-html-minifier
devopsjavascriptv0.1.0
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
var htmlMinifier = require('connect-html-minifier');
import htmlMinifier from 'connect-html-minifier';
CJS-only; no ESM or TypeScript support

Demonstrates basic usage of connect-html-minifier as Connect middleware with minification options.

var connect = require('connect'); var htmlMinifier = require('connect-html-minifier'); connect() .use(htmlMinifier({ removeComments: true, collapseWhitespace: true })) .listen(8080); console.log('Server running on port 8080');
Debug
Known issues
deprecatedPackage has not been updated since 2015 and is considered abandoned.
fix
Consider using express-minify-html or html-minifier-terser with custom middleware.
affects: all
gotchaRequires html-minifier as a peer dependency, which may have breaking changes.
fix
Pin html-minifier version or use a dedicated minification middleware.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'connect-html-minifier'
Package not installed or missing from node_modules.
fix
Run `npm install connect-html-minifier`.
TypeError: htmlMinifier is not a function
Incorrect import style (ESM import used for CJS module).
fix
Use `const htmlMinifier = require('connect-html-minifier');`
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
html-minifierrequiredCore minification library
Agent activity
6 hits · last 30 days
node
6
Resources
connect-html-minifier — npm install connect-html-minifier · libregistry