hexo-lightning-minify
WIP
中文版本
Introduction
This plugin is a minifier module split from hexo-renderer-multi-next-markdown-it.
Based on more modern minifiers (such as lightningcss
and minify-html
), it significantly improves speed compared to the older version.
If you need more comprehensive optimization, you can try hexo-optimize. This project is more inclined to exist as a supporting package for ShokaX, thus it only provides basic minification and optimization functions.
Installation
pnpm add hexo-lightning-minify # Recommended to use pnpm
npm install hexo-lightning-minify
Configuration
minify:
js:
enable: true
exclude:
css:
enable: true
options:
targets: ">= 0.5%"
exclude:
html:
enable: true
options:
comments: false
exclude:
image:
enable: true
options:
avif: false
webp: true
quality: 80
effort: 2
replaceSrc: true
exclude:
Features
Comparison
On ShokaX v0.3.9:
When run hexo g
,hexo-lightning-minify
runs ~1.88x faster than HRMNMI(HRMMIR),~1.3x faster than hexo-neat
based on hexo-many-posts test:
with Hexo 6.3.0, only test the compression of html, css and js.
| base | hexo-neat | hexo-minify | hexo-all-minifier | hexo-lightning-minify |
---|
landscape | 10.529s | 37.918s | 36.844s | 38.572s | 16.304s |
next | 27.275s | 36.124s | 42.854s | 37.063s | 29.880s |
butterfly | 13.853s | 26.641s | 26.736s | 35.973s | 16.796s |
particlex | 24.422s | 200.641s | 193.981s | 201.601s | 40.478s |
reimu | 17.631s | 52.432s | 48.524s | 51.835s | 23.938s |
shokax(hexo-renderer-marked) | 13.189s | 20.618s | 19.658s | 22.448s | 14.619s |
| base | hexo-neat | hexo-minify | hexo-all-minifier | hexo-lightning-minify |
---|
landscape | 99,617,529B | 97,186,156B | 92,010,232B | 97,184,707B | 88,175,339B |
next | 32,469,157B | 30,087,003B | 28,744,583B | 30,059,443B | 28,020,740B |
butterfly | 37,593,633B | 37,237,074B | 33,485,597B | 34,897,171B | 35,504,670B |
particlex | 540,876,348B | 226,997,833B | 214,050,994B | 226,990,791B | 221,896,130B |
reimu | 110,252,086B | 95,756,049B | 91,074,639B | 95,715,486B | 88,088,009B |
shokax(hexo-renderer-marked) | 142,585,026B | 142,404,138B | 140,988,094B | 142,011,849B | 140,457,331B |
The hexo-theme-particlex has been removed from the chart for a clearer comparison.