Registry / devops / sulky-optimizer-html-minifier

sulky-optimizer-html-minifier

JSON →
library1.0.0jsnpmunverified

An HTML minifier plugin for the Sulky build optimizer, version 1.0.0. It integrates with Sulky to minify HTML output during builds. Released as an initial stable version, it leverages html-minifier internally. Unlike generic minifiers, it is specifically designed to work within the Sulky optimizer pipeline, providing automatic integration for projects using Sulky.

npm install sulky-optimizer-html-minifier
INSTALL
IMPORT
SIG · SULKY-OPTIMIZER-HT
S
sulky-optimizer-html-minifier
devopsjavascriptv1.0.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.

OptHtmlMinifier
import { OptHtmlMinifier } from 'sulky-optimizer-html-minifier';
const { OptHtmlMinifier } = require('sulky-optimizer-html-minifier');
The package is ESM-only; require() will fail in Node < 16 with type:module.
default
import minifier from 'sulky-optimizer-html-minifier';
Default export is the class itself; same as named export OptHtmlMinifier.
MinifyOptions
import type { MinifyOptions } from 'sulky-optimizer-html-minifier';
import { MinifyOptions } from 'sulky-optimizer-html-minifier';
MinifyOptions is a TypeScript type, not a runtime value. Use 'import type' to avoid side effects.

This shows how to import and use the OptHtmlMinifier plugin with the Sulky optimizer to minify an HTML string.

import { OptHtmlMinifier } from 'sulky-optimizer-html-minifier'; import { SulkyOptimizer } from 'sulky'; const optimizer = new SulkyOptimizer(); optimizer.use(new OptHtmlMinifier({ removeComments: true, collapseWhitespace: true })); const result = optimizer.process('<html> <!-- comment --> <body> <p>hi</p> </body> </html>'); console.log(result); // '<html><body><p>hi</p></body></html>'
Debug
Known issues
gotchaThe plugin minifies only if Sulky's 'html' pass is enabled; otherwise it silently does nothing.
fix
Ensure Sulky is configured with { passes: ['html'] } or similar.
affects: 1.0.0
deprecatedOptions passed to constructor may override global Sulky HTML minification settings; check Sulky docs for precedence.
fix
Avoid setting conflicting options; prefer Sulky configuration if available.
affects: 1.0.0
Errors
Common errors & fixes
SyntaxError: Unexpected token '??='
The package uses nullish coalescing assignment which is only available in Node 16+ or ES2021.
fix
Update Node.js to version 16 or later, or use a transpiler like Babel.
ERR_REQUIRE_ESM
The package is ESM-only and cannot be loaded with require().
fix
Use import syntax or set { type: 'module' } in package.json.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
html-minifierrequiredCore dependency for HTML minification logic.
sulkyoptionalPeer dependency; plugin is designed for Sulky build system.
Agent activity
7 hits · last 30 days
node
4
Amazon
2
Resources
sulky-optimizer-html-minifier — npm install sulky-optimizer-html-minifier · libregistry