Registry / devops / hexo-yam

hexo-yam

JSON →
library9.0.0jsnpmunverified

Yet Another Minifier (YAM) is a Hexo plugin for minifying and compressing HTML, JS, CSS, SVG, XML, and JSON in static sites. Current stable version is 9.0.0 (released 2024). It supports Gzip, Brotli, and Zstd compression, with configurable options per file type. Unlike similar plugins, YAM offers extensive per-engine fine-tuning and integrates with Hexo's renderer pipeline. It requires Node >= 18.12.0 and is actively maintained by curbengh.

npm install hexo-yam
INSTALL
IMPORT
SIG · HEXO-YAM
H
hexo-yam
devopsjavascriptv9.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-yam
require('hexo-yam') // In a Hexo plugin file
import hexoYam from 'hexo-yam'
CommonJS only; Hexo does not support ESM for plugins.
default
module.exports = require('hexo-yam')
export default require('hexo-yam')
Hexo expects module.exports, not ES module export.
minifyOptions
hexo.config.yam = { /* options */ }
require('hexo-yam').config = {...}
Configuration is set via Hexo's config, not direct import.

Configuration for hexo-yam in Hexo's _config.yml, enabling minification and optional compression.

// In site's root _config.yml # https://github.com/curbengh/hexo-yam yam: enable: true html: minifier: html-minifier options: removeComments: true collapseWhitespace: true css: minifier: clean-css options: compatibility: '*' js: minifier: terser options: compress: { drop_console: true } svg: minifier: svgo options: {} xml: minifier: xmlminifier options: {} json: minifier: jsonminifier options: {} gzip: true brotli: false zstd: false output: gzip_ext: .gz brotli_ext: .br zstd_ext: .zst
Debug
Known issues
breakingv9.0.0 drops support for Node < 18.12.0 and may change default minifiers or options.
fix
Upgrade Node.js to >=18.12.0 and review minifier options in _config.yml.
affects: >=9.0.0
gotchaMinification options are applied globally; per-post overrides are not supported.
fix
Use the 'exclude' option to skip specific files or paths.
affects: >=0.0.0
deprecatedUglifyJS support was removed in v7, replaced by terser.
fix
Replace 'uglify' with 'terser' in your config.
affects: >=7.0.0
gotchaEnabling brotli or zstd requires Node.js native module or external CLI tool; check compatibility.
fix
Install iltorb or use CLI tools; see docs for details.
affects: >=0.0.0
breakingv6.0.0 changed the configuration structure; old 'html_minifier' syntax no longer works.
fix
Use the nested 'html.minifier' syntax as shown in quickstart.
affects: >=6.0.0
Errors
Common errors & fixes
Error: Cannot find module 'html-minifier'
The minifier package (e.g., html-minifier) is not installed globally or in node_modules.
fix
Run 'npm install --save-dev html-minifier' or add it to package.json.
ENOENT: no such file or directory, open '/path/to/site/public/index.html'
Output directory does not exist; usually due to missing 'hexo generate' run.
fix
Run 'hexo clean && hexo generate' before deploying or serving.
Invalid options: options.compatibility is not a valid CleanCSS option
CleanCSS options changed; the 'compatibility' key may be obsolete or misnamed.
fix
Check clean-css documentation and adjust options (e.g., 'level: 2').
TypeError: Cannot read properties of undefined (reading 'replace')
The plugin processes a file that returns null content.
fix
Ensure all source files exist and are readable; exclude broken files.
Upgrade
Version history
9.0.0latest on npm
Audit
Dependencies
hexorequiredPeer dependency required as a Hexo plugin; provides the theme and rendering context.
Agent activity
4 hits · last 30 days
node
4
Resources
hexo-yam — npm install hexo-yam · libregistry