Registry /
devops / sulky-optimizer-html-minifier
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>'
Errors
Common errors & fixes
SyntaxError: Unexpected token '??='
The package uses nullish coalescing assignment which is only available in Node 16+ or ES2021.
fixUpdate 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().
fixUse import syntax or set { type: 'module' } in package.json. Audit
Dependencies
html-minifierrequiredCore dependency for HTML minification logic.
sulkyoptionalPeer dependency; plugin is designed for Sulky build system.