mynameiswhm / brotli-webpack-plugin

Prepare Brotli-compressed versions of assets to serve them with Content-Encoding: br
MIT License
218 stars 23 forks source link
brotli webpack

brotli plugin for webpack

Greenkeeper badge

This plugin compresses assets with Brotli compression algorithm using zlib, iltorb or brotli.js libraries for serving it with ngx_brotli or such.

Installation

npm install --save-dev brotli-webpack-plugin

Usage

var BrotliPlugin = require('brotli-webpack-plugin');
module.exports = {
    plugins: [
        new BrotliPlugin({
            asset: '[path].br[query]',
            test: /\.(js|css|html|svg)$/,
            threshold: 10240,
            minRatio: 0.8
        })
    ]
}

Arguments:

Optional arguments for Brotli (see iltorb doc for details):

License

Heavily copy-pasted from webpack/compression-webpack-plugin by Tobias Koppers.

Licensed under MIT.