@mapleinside/compression-webpack-plugin
Prepare compressed versions of assets to serve them with Content-Encoding.
Last updated 4 years ago by nicolascava .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @mapleinside/compression-webpack-plugin 
SYNC missed versions from official npm registry.

Compression Webpack Plugin

Codeship status for Compression Webpack Plugin

Prepare compressed versions of assets to serve them with Content-Encoding.

Usage

import CompressionPlugin from '@mapleinside/compression-webpack-plugin';

export default {
  plugins: [
	new CompressionPlugin({
	  asset: '{file}.gz',
	  algorithm: 'gzip',
	  regExp: /\.js$|\.html$/,
	  threshold: 10240,
	  minRatio: 0.8,
	})
  ]
}

Arguments:

  • asset: the target asset name. {file} is replaced with the original asset. Defaults to '{file}.gz';
  • algorithm: can be a function(buf, callback) or a string. For a string the algorithm is taken from zlib. Defaults to 'gzip';
  • regExp: all assets matching this RegExp are processed. Defaults to every asset;
  • threshold: only assets bigger than this size are processed. In bytes. Defaults to 0;
  • minRatio: only assets that compress better that this ratio are processed. Defaults to 0.8.

License

(The MIT License)

Copyright (c) 2015 Maple Inside

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Current Tags

  • 1.0.0-beta.2                                ...           latest (4 years ago)

3 Versions

  • 1.0.0-beta.2                                ...           4 years ago
  • 1.0.0-beta1                                ...           4 years ago
  • 1.0.0-alpha1                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (1)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |