Registry / devops / hihtml

hihtml

JSON →
library1.3.2jsnpmunverified

hihtml (v1.3.2) bundles HTML validation, deprecated markup detection, link checking, and minification into a single CLI and programmatic API. It wraps HTML-validate, ObsoHTML, Node's built-in http/https, and HTML Minifier Next with strong defaults and a conformance gate (--all) that prevents minification if validation fails. Updated regularly on npm, primarily maintained by j9t. Differentiators: all-in-one tool, programmatic plus CLI, built-in conformance gate, highly configurable via JSON settings file.

npm install hihtml
INSTALL
IMPORT
SIG · HIHTML
H
hihtml
devopsjavascriptv1.3.2
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.

checkCode
import { checkCode } from 'hihtml'
import hihtml from 'hihtml'
hihtml exports named functions, not a default export. Available in ESM only (no CommonJS).
checkLinks
import { checkLinks } from 'hihtml'
const { checkLinks } = require('hihtml')
Package is ESM-only. Requires Node >= 16 and "type":"module" in package.json or .mjs extension.
minify
import { minify } from 'hihtml'
import { minify as minimize } from 'hihtml'
Function name is `minify`, not `minimize` or `minifier`.
collect
import { collect } from 'hihtml'
collect() returns an array of file paths. Required as input for other functions.
minifyString
import { minifyString } from 'hihtml'
String variant that accepts HTML as a string (no file I/O).

Programmatic usage: validate HTML, check links, minify, and enforce conformance gate with string variants.

import { collect, checkCode, checkLinks, minify, minifyString } from 'hihtml'; // Validate and check for deprecated markup const files = await collect('./src'); const validationResult = await checkCode(files); console.log('Errors:', validationResult.validation.countErrors); console.log('Deprecated:', validationResult.deprecation.countIssues); // Check links const linkResult = await checkLinks(files); console.log('Broken links:', linkResult.countBroken); // Minify in-place const minifyResult = await minify(files, files); console.log('Saved bytes:', minifyResult.saved); // Minify a string directly const minified = await minifyString('<p>Hello world</p>'); console.log('Minified:', minified); // Use with --all equivalent logic const { validation } = await checkCode(files); if (validation.countErrors === 0) { await minify(files, files); }
Debug
Known issues
breakingPackage is ESM-only. CommonJS require() will throw an error.
fix
Use import syntax and ensure Node.js version >= 16 with "type":"module" in package.json or .mjs file extension.
affects: >=1.0.0
gotchaAll functions are async. Forgetting await returns a Promise, not the result.
fix
Always await hihtml functions: const result = await checkCode(files);
affects: >=1.0.0
gotchacollect() defaults to current directory with optional path argument, but returns empty array if no HTML files found.
fix
Verify files exist: collect returns array; check length before processing.
affects: >=1.0.0
deprecatedThe -a flag (--all) behavior changed: it now acts as a conformance gate, running check-code then minify only if no errors. Previously it ran all three tasks independently.
fix
For independent tasks, use individual flags: hihtml -c -l -m
affects: >=1.2.0
Errors
Common errors & fixes
SyntaxError: The requested module 'hihtml' does not provide an export named 'default'
Trying to import default export but package only provides named exports.
fix
Use named imports: import { checkCode } from 'hihtml';
ERR_REQUIRE_ESM: require() of ES Module /node_modules/hihtml/index.js not supported.
Using require() on an ESM-only package.
fix
Switch to import syntax or use dynamic import(): const hihtml = await import('hihtml');
TypeError: checkCode is not a function
Forgetting to await the asynchronous function or destructuring incorrectly.
fix
Ensure you await the result: const result = await checkCode(files);
Upgrade
Version history
1.3.2latest on npm
Audit
Dependencies
html-validaterequiredHTML validation engine
obsohtmlrequiredDeprecated markup detection
html-minifier-nextrequiredHTML minification
Agent activity
8 hits · last 30 days
node
8
Resources
packagehihtml
hihtml — npm install hihtml · libregistry