Wonderjar's Blog

前端加载优化

2018-05-14

(不断补充)

##基本技术
bundle

gzip
放一段代码免得再去找,

1
2
3
4
5
6
7
new CompressionPlugin({
asset: "[path].gz[query]",
algorithm: "gzip",
test: /\.js$|\.css$|\.html$/,
threshold: 10240,
minRatio: 0.8
})

##图片

##框架
延迟加载
vue,

1
2
3
4
{ path: ':ticketId/log', name: 'ticket_log',
component: resolve => require(['@/views/somepage'], resolve),
meta: { label: 'somepage', auth: true }
},

##CDN

##体验
skeleton screen,也可以用库,https://github.com/dvtng/react-loading-skeleton