Socket
Socket
Sign inDemoInstall

html-compression-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-compression-webpack-plugin

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


Version published
Weekly downloads
3
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

html compression plugin for webpack

Usage

Credits to @sokra for the code from compression-webpack-plugin (https://github.com/webpack/compression-webpack-plugin)

var HTMLCompressionPlugin = require("html-compression-webpack-plugin");
module.exports = {
	plugins: [
		new HTMLCompressionPlugin({
			asset: "[path].gz[query]",
			algorithm: "gzip",
			test: /\.js$|\.html$/,
			threshold: 10240,
			minRatio: 0.8
		})
	]
}

Arguments:

  • asset: The target asset name. [file] is replaced with the original asset. [path] is replaced with the path of the original asset and [query] with the query. Defaults to "[path].gz[query]".
  • algorithm: Can be a function(buf, callback) or a string. For a string the algorithm is taken from zlib (or zopfli for zopfli). Defaults to "gzip".
  • test: All assets matching this RegExp are processed. Defaults to every HTML 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.

Option Arguments for Zopfli (see node-zopfli doc for details):

  • verbose: Default: false,
  • verbose_more: Default: false,
  • numiterations: Default: 15,
  • blocksplitting: Default: true,
  • blocksplittinglast: Default: false,
  • blocksplittingmax: Default: 15

License

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

FAQs

Package last updated on 07 Dec 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc