File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ Arguments:
4242* ` test ` : All assets matching this RegExp are processed. Defaults to every asset.
4343* ` threshold ` : Only assets bigger than this size are processed. In bytes. Defaults to ` 0 ` .
4444* ` 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 ` .
4546
4647Option Arguments for Zopfli (see [ node-zopfli] ( https://github.com/pierreinglebert/node-zopfli#options ) doc for details):
4748* verbose: Default: false,
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ function CompressionPlugin(options) {
4848 this . test = options . test || options . regExp ;
4949 this . threshold = options . threshold || 0 ;
5050 this . minRatio = options . minRatio || 0.8 ;
51+ this . deleteOriginalAssets = options . deleteOriginalAssets || false ;
5152}
5253module . exports = CompressionPlugin ;
5354
@@ -80,6 +81,9 @@ CompressionPlugin.prototype.apply = function(compiler) {
8081 return sub [ p1 ] ;
8182 } ) ;
8283 assets [ newFile ] = new RawSource ( result ) ;
84+ if ( this . deleteOriginalAssets ) {
85+ delete assets [ file ] ;
86+ }
8387 callback ( ) ;
8488 } . bind ( this ) ) ;
8589 } . bind ( this ) , callback ) ;
You can’t perform that action at this time.
0 commit comments