compression-webpack-plugin
Advanced tools
Comparing version 0.3.0 to 0.3.1
26
index.js
@@ -14,2 +14,3 @@ /* | ||
this.algorithm = options.algorithm || "gzip"; | ||
this.compressionOptions = {}; | ||
if(typeof this.algorithm === "string") { | ||
@@ -22,12 +23,13 @@ if (this.algorithm === "zopfli") { | ||
} | ||
this.algorithm = function (content, fn) { | ||
zopfli.gzip(content, { | ||
verbose: options.hasOwnProperty('verbose') ? options.verbose : false, | ||
verbose_more: options.hasOwnProperty('verbose_more') ? options.verbose_more : false, | ||
numiterations: options.numiterations ? options.numiterations : 15, | ||
blocksplitting: options.hasOwnProperty('blocksplitting') ? options.blocksplitting : true, | ||
blocksplittinglast: options.hasOwnProperty('blocksplittinglast') ? options.blocksplittinglast : false, | ||
blocksplittingmax: options.blocksplittingmax ? options.blocksplittingmax : 15 | ||
}, fn); | ||
this.compressionOptions = { | ||
verbose: options.hasOwnProperty('verbose') ? options.verbose : false, | ||
verbose_more: options.hasOwnProperty('verbose_more') ? options.verbose_more : false, | ||
numiterations: options.numiterations ? options.numiterations : 15, | ||
blocksplitting: options.hasOwnProperty('blocksplitting') ? options.blocksplitting : true, | ||
blocksplittinglast: options.hasOwnProperty('blocksplittinglast') ? options.blocksplittinglast : false, | ||
blocksplittingmax: options.blocksplittingmax ? options.blocksplittingmax : 15 | ||
}; | ||
this.algorithm = function (content, options, fn) { | ||
zopfli.gzip(content, options, fn); | ||
}; | ||
} else { | ||
@@ -37,3 +39,3 @@ var zlib = require("zlib"); | ||
if(!this.algorithm) throw new Error("Algorithm not found in zlib"); | ||
this.algorithm = this.algorithm.bind(zlib, { | ||
this.compressionOptions = { | ||
level: options.level || 9, | ||
@@ -46,3 +48,3 @@ flush: options.flush, | ||
dictionary: options.dictionary | ||
}); | ||
}; | ||
} | ||
@@ -72,3 +74,3 @@ } | ||
if(originalSize < this.threshold) return callback(); | ||
this.algorithm(content, function(err, result) { | ||
this.algorithm(content, this.compressionOptions, function(err, result) { | ||
if(err) return callback(err); | ||
@@ -75,0 +77,0 @@ if(result.length / originalSize > this.minRatio) return callback(); |
{ | ||
"name": "compression-webpack-plugin", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"author": "Tobias Koppers @sokra", | ||
@@ -5,0 +5,0 @@ "description": "Prepare compressed versions of assets to serve them with Content-Encoding", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5254
85