hwl

html-webpack-local-cache-plugin

使用localstorage缓存js和css资源,需要配合HtmlWebpackPlugin使用

Showing:

Popularity

Downloads/wk

3

Maintenance

No Maintenance Data Available

Package

Dependencies

0

Size (min+gzip)

1.2KB

License

ISC

Type Definitions

Tree-Shakeable

No?

Categories

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
    })
  ]
};

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100