Registry / devops / hexo-html-minifier

hexo-html-minifier

JSON →
library1.0.0jsnpmunverified

A Hexo plugin that minifies HTML output files using HTMLMinifier. Current stable version is 1.0.0, with infrequent releases. It integrates directly as a Hexo filter, providing easy configuration through the main _config.yml and supports excluding files via globbing. Compared to other minifiers, it offers deep integration with Hexo's build pipeline and respects Hexo's 'more' tag comments by default.

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

hexo-html-minifier
npm install hexo-html-minifier --save
No JavaScript import needed; plugin is activated by being in package.json. Configuration is done via _config.yml.

Install the plugin via npm. After installation, HTML files will be minified automatically on hexo generate.

npm install hexo-html-minifier --save
Debug
Known issues
gotchaOptions set in _config.yml override defaults but are merged; be aware that some options may not be recognized if misspelled.
fix
Ensure option names match HTMLMinifier documentation exactly (e.g., 'collapseWhitespace' not 'collapseWhiteSpace').
affects: >=1.0.0
gotchaThe 'ignoreCustomComments' option requires YAML type !!js/regexp for regex patterns; plain strings won't work.
fix
Use !!js/regexp /pattern/ in _config.yml (e.g., ignoreCustomComments: [ !!js/regexp /^\s*more/ ])
affects: >=1.0.0
gotchaExclude patterns use micromatch globbing; incorrect patterns may not exclude files properly.
fix
Test glob patterns using micromatch documentation (e.g., 'exclude: **/draft/*.html').
affects: >=1.0.0
Errors
Common errors & fixes
Error: Minification failed for...
HTMLMinifier encounters invalid HTML or syntax errors.
fix
Validate HTML with tools like W3C validator. Disable minification for problematic files via 'exclude' option.
TypeError: ignoreCustomComments is not iterable
ignoreCustomComments is not an array or contains invalid regex.
fix
Ensure ignoreCustomComments is an array of RegExp objects using !!js/regexp YAML type.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
html-minifierrequiredCore dependency for HTML minification functionality.
Agent activity
6 hits · last 30 days
node
6
Resources
hexo-html-minifier — npm install hexo-html-minifier · libregistry