使用前请确保已经安装了 NodeJS 环境。
参考 index.test.js 文件
const minifier = require('./index.js')
const minifiedhtml = await minifier(`<body></body>`)
- npm install
- npm run test
# v1.2.0
# 新增:CSS 非语义化压缩
[001] dailiyun.html reduced to: 41.47%
[002] dailiyun_wap.html reduced to: 49.89%
[003] snapshot_raw.html reduced to: 40.96%
[004] snapshot_with_singlefile_plugin.html reduced to: 85.51%
# v1.1.0
# 新增:HTML 非语义化压缩
[001] dailiyun.html reduced to: 44.27%
[002] dailiyun_wap.html reduced to: 52.79%
[003] snapshot_raw.html reduced to: 44.09%
[004] snapshot_with_singlefile_plugin.html reduced to: 90.73%
# v1.0.0
# 新增:CSS 摇树优化
[001] reduced to: 47.34%
[002] reduced to: 59.84%
[003] reduced to: 51.81% # 压缩直接用浏览器保存的 HTML 文件,效果约为 50%
[004] reduced to: 92.66% # 压缩使用 SingleFile 插件保存的 HTML 文件,效果不大
从测试文件来看,压缩效果在 45% 上下浮动。