做者:lazyboy
邮箱:upc_xbt@163.com
同步发布到『www.lazyboy.site』css
本人Hexo博客使用主题为NEXThtml
不知是主题缘由仍是其余缘由,生成的静态文件存在大量空白,在必定程度上影响了网页加载。网上寻找解决方案,能够对文件进行压缩。git
使用gulp精简hexo博客代码github
Hexo-Neat介绍gulp
本着能偷懒则偷懒的原则,选择了使用hexo-neat插件,hexo-neat插件使用HTMLMinifier、clean-css、UglifyJS插件实现。segmentfault
安装完成之后,打开站点配置文件,添加如下属性。启用hexo-neat
的基础上,能够选择是否压缩HTML、CSS、Js文件,均有相应的开关选项。hexo
# 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'