html-webpack-local-cache-plugin
v1.0.1
Published
使用localstorage缓存js和css资源,需要配合HtmlWebpackPlugin使用
Downloads
4
Readme
使用localstorage缓存js和css资源,需要配合HtmlWebpackPlugin使用。
使用方法
var HtmlWebpackPlugin = require('html-webpack-plugin');
var HtmlWebpackLocalCachePlugin = require('html-webpack-local-cache-plugin');
var webpackConfig = {
entry: 'index.js',
output: {
path: __dirname + '/dist',
filename: 'index_bundle.js'
},
plugins: [
new HtmlWebpackPlugin(),
new HtmlWebpackLocalCachePlugin({
cacheSource: '(app\..*\.js|vendor\..*\.js)$', // 通过正则校验需要缓存的文件
cacheEnsure: false, // 是否连ensure异步加载的js也缓存,默认false
cssSync: true, // 是否使用document.write的方式加载,false则用xhr加载css,默认是false
jsSync: true // 是否使用document.write的方式加载,false则用xhr加载js,默认是false
})
]
};