Registry / devops / html-minifier-stream

html-minifier-stream

JSON →
library0.1.0jsnpmunverified

Stream interface for html-minifier (v3.x), enabling piping of HTML data through a transform stream for minification. Created by gomoto, this package provides a simple way to integrate html-minifier into Node.js stream pipelines. Current version 0.1.0, with no active maintenance since 2016. Alternative to using html-minifier directly with buffers or strings.

npm install html-minifier-stream
INSTALL
IMPORT
SIG · HTML-MINIFIER-STRE
H
html-minifier-stream
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.

htmlMinifierStream
✓ import htmlMinifierStream from 'html-minifier-stream'
✗ const htmlMinifierStream = require('html-minifier-stream')
No ESM exports; the module is CJS only.
default export
✓ const htmlMinifierStream = require('html-minifier-stream')
✗ const { htmlMinifierStream } = require('html-minifier-stream')
The package exports a single function, not an object.
options
✓ const stream = require('html-minifier-stream')({ removeComments: true, collapseWhitespace: true })
✗ const stream = require('html-minifier-stream').createStream({})
Options are passed directly to the function call; there is no separate factory method.

Shows how to pipe an HTML file through the minifier stream and output to a new file.

const fs = require('fs'); const htmlMinifierStream = require('html-minifier-stream'); const options = { removeComments: true, collapseWhitespace: true, removeAttributeQuotes: true }; fs.createReadStream('index.html') .pipe(htmlMinifierStream(options)) .pipe(fs.createWriteStream('minified.html')) .on('finish', () => console.log('Minification complete'));
Debug
Known issues
deprecatedPackage is unmaintained since 2016. html-minifier v3.x is old; newer versions may have breaking changes.
fix
Consider using html-minifier directly or find an alternative active package.
affects: >=0.1.0
breakingRequires html-minifier@3.x as peer dependency; incompatible with html-minifier v4+.
fix
Use html-minifier@3.x or switch to another solution.
affects: 0.1.0
gotchaThe stream does not support object mode; it expects string/buffer input only.
fix
Ensure your source stream emits buffers or strings; use .toString() if needed.
affects: 0.1.0
Errors
Common errors & fixes
Cannot find module 'html-minifier-stream'
Package not installed or not in node_modules.
fix
Run 'npm install html-minifier-stream' and ensure package.json includes it.
Invalid transform stream: options must be an object
Called htmlMinifierStream() without arguments or with non-object.
fix
Pass an options object, even if empty: htmlMinifierStream({})
htmlMinifierStream is not a function
Incorrect import (destructured) when using CommonJS.
fix
Use 'const htmlMinifierStream = require('html-minifier-stream')' and call it as a function.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies
html-minifierrequiredCore dependency that provides minification logic; peer dependency at version 3.x
Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
html-minifier-stream — npm install html-minifier-stream · libregistry