We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e6f493d commit 12d167cCopy full SHA for 12d167c
index.js
@@ -3,6 +3,7 @@
3
Author Tobias Koppers @sokra
4
*/
5
var async = require("async");
6
+var url = require('url');
7
8
var RawSource = require("webpack/lib/RawSource");
9
@@ -36,7 +37,15 @@ CompressionPlugin.prototype.apply = function(compiler) {
36
37
this.algorithm(content, function(err, result) {
38
if(err) return callback(err);
39
if(result.length / originalSize > this.minRatio) return callback();
- var newFile = this.asset.replace(/\{file\}/g, file);
40
+ var parse = url.parse(file);
41
+ var sub = {
42
+ file: file,
43
+ path: parse.pathname,
44
+ query: parse.query
45
+ }
46
+ var newFile = this.asset.replace(/\{(file|path|query)\}/g, function(p0,p1) {
47
+ return sub[p1];
48
+ });
49
assets[newFile] = new RawSource(result);
50
callback();
51
}.bind(this));
0 commit comments