- 环境配置
- 配置
grunt
- 配置
grunt-pagespeed
- 配置
ngrok
- 添加 npm scripts - psi, psi:watch, build, build:watch
- 配置
- Minification
- HTML
- basic minification - htmlmin html-minifier
- JS 代码中的注释没移除 - minifyJS: true
- JS 代码还有换行和空格 - minifyJS: true
- CSS
- basic minification - cssmin
-
dist/pizza/css/main.min.css
还有注释 - 420 / (420 + 9857) = 4%,不是很多,不搞了
- JavaScript
- HTML
- Uglification
- JavaScript - 只有一些函数名没有 uglify,不过比率非常小,估计不到0.01%。故忽略不计。
- Compress
- GZip HTML
- GZip CSS
- GZip JavaScript
- Images
- 自动化 - 在 img 标签中指定了 100px 的图片,自动压缩成这个比例
- Combine critical resource
- CSS -
bootstrap.css
+style.css
->main.min.css
- JavaScript
- CSS -
- Defer and asynchronously load non-critical resource
- CSS
- 将 render blocking CSS 放在页面底端
- JavaScript
- CSS
- Cache - hard or impossible to modify Github Pages server
- HTML
- CSS
- JavaScript
- Images
- Inline critical and small resources
- JavaScript
- CSS
- organize entries
- Others
- Optimize online images
- Optimize online fonts
- Optimize css import
- Refactor all duplicate configuration?
- Can they auto scan new components with a new folder and similar structure? - yes most of them, while some cannot:
concat
task: not able to auto-scan components as now components are hard-codedimagemagick-resize
task: images path can only be hardcoded as they need unique size while resizingcritical
task: hardcoded due to lack of support of the plugin
- Can they auto scan files? - yes, as long as they're following project naming/structure conventions like:
- js files: make sure they are categorized and placed under
vendor/
orbundle/
directory - css files: make sure they are categorized and placed under different directories like
main/
orprint/
- html files: make sure they are placed under the component directory root
- images: make sure they are placed under
images/
folder under the component directory root - components: make sure they have their own directory under
src
, likeindex/
andpizza/
- js files: make sure they are categorized and placed under
- Support component based build & watch? - not necessary at the moment
- Can they auto scan new components with a new folder and similar structure? - yes most of them, while some cannot: