File tree 2 files changed +5
-0
lines changed
2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ Arguments:
42
42
* ` test ` : All assets matching this RegExp are processed. Defaults to every asset.
43
43
* ` threshold ` : Only assets bigger than this size are processed. In bytes. Defaults to ` 0 ` .
44
44
* ` minRatio ` : Only assets that compress better that this ratio are processed. Defaults to ` 0.8 ` .
45
+ * ` deleteOriginalAssets ` : Whether to delete the original assets or not. Defaults to ` false ` .
45
46
46
47
Option Arguments for Zopfli (see [ node-zopfli] ( https://github.com/pierreinglebert/node-zopfli#options ) doc for details):
47
48
* verbose: Default: false,
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ function CompressionPlugin(options) {
48
48
this . test = options . test || options . regExp ;
49
49
this . threshold = options . threshold || 0 ;
50
50
this . minRatio = options . minRatio || 0.8 ;
51
+ this . deleteOriginalAssets = options . deleteOriginalAssets || false ;
51
52
}
52
53
module . exports = CompressionPlugin ;
53
54
@@ -80,6 +81,9 @@ CompressionPlugin.prototype.apply = function(compiler) {
80
81
return sub [ p1 ] ;
81
82
} ) ;
82
83
assets [ newFile ] = new RawSource ( result ) ;
84
+ if ( this . deleteOriginalAssets ) {
85
+ delete assets [ file ] ;
86
+ }
83
87
callback ( ) ;
84
88
} . bind ( this ) ) ;
85
89
} . bind ( this ) , callback ) ;
You can’t perform that action at this time.
0 commit comments