npm.io
0.1.0 • Published 6 years ago

file-size-check-plugin

Licence
MIT
Version
0.1.0
Deps
0
Size
3 kB
Vulns
0
Weekly
0

file-size-check-plugin

npm

A Webpack plugin to check file (js|css) size after build by webpack and gzip compress.

Installation:

Using npm:

$ npm install compression-webpack-plugin file-size-check-plugin --save-dev 

Example:

Need to use compression-webpack-plugin, Because file-size-check-plugin check the file end with .gz

If you don't set the 'fileSizeLimit' params, it will be set at 300 * 1024 by default.

const CompressionWebpackPlugin = require('compression-webpack-plugin');
const FileSizeCheck = require('file-size-check-plugin');

webpackConfig = {
  plugins: [
    new CompressionWebpackPlugin({
      test: /\.(js|css)(\?.*)?$/i
    }),
    new FileSizeCheck({ 
      fileSizeLimit: 300 * 1024
    })
  ]
};

License

MIT (http://www.opensource.org/licenses/mit-license.php)

Keywords