An Express.js middleware that automatically minifies HTML responses using html-minifier. This package intercepts HTML responses and reduces file size by removing whitespace, comments, and other unnecessary characters. Version 1.0.4 is the latest stable release. It has low release cadence and minimal dependencies, but its approach (intercepting res.end) can conflict with other middleware or streaming responses. Unlike other minifiers, it does not require manual wrapping of res.send or res.render.
npm install express-html-minifyNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic Express setup with HTML minification middleware. The middleware minifies all HTML responses.
Ensure no other middleware modifies res.end before this middleware. Disable compression for HTML responses if issues occur.
Consider using a more actively maintained alternative like 'compression' middleware or custom minification.
Run 'npm install express-html-minify' to install the package.
Use 'app.use(minify)' without parentheses.
Ensure the minify middleware is placed before any middleware that may modify res.end.