Fork me on GitHub

Hexo博客压缩优化

Hexo博客生成的静态文件存在大量空白,不仅难看,而且在一定程度上影响用户网页加载,需要对js和css进行压缩。

部署设置

插件介绍

hexo-neat
hexo-neat插件使用HTMLMinifier、clean-css、UglifyJS插件实现

安装插件

1
$ npm install hexo-neat --save

配置

在站点配置增加如下属性,可以选择是否压缩HTML、CSS、Js文件,均有相应的开关选项。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# hexo-neat

neat_enable: true

neat_html:
enable: true
exclude:

neat_css:
enable: true
exclude:
- '*.min.css'

neat_js:
enable: true
mangle: true
output:
compress:
exclude:
- '*.min.js'

参考资料

hexo博客压缩优化

======================================================
希望各位朋友支持一下

本文作者:dongsheng
本文地址https://mds1455975151.github.io/archives/2ac3214e.html
版权声明:转载请注明出处!

坚持技术分享,您的支持将鼓励我继续创作!