对于任何一个网站来说,优化页面的访问速度是必须的,从体验来讲,没人能忍耐加载页面十秒以上或长时间处于空白或加载状态。优化访问速度的方法有很多,今天只介绍傻瓜式的插件安装方法:
安装插件
在站点目录下Git bash一下,使用如下命令安装hexo-neat插件:
1 | npm install hexo-neat --save |
主配置_config.yml文末添加:(其中exclude板块是特别添加,针对你的静态资源进行筛选)
1 | # hexo-neat |
运行(因为mangle: true #打印日志,我们能看到运行流程)
【INFO neat the html:xxxx.md】先压缩md文件的换行和空白
【INFO neat the html: xxxx.ejs】压缩ejs配置文件(这里也有很多换行和空格),这是html片段格式文件。
现在是neat工作最重要的部分之一:压缩js和css。
最后是(hexo generate)将md文章转换成html语言格式的过程。


每日一图
