@@ -29,7 +29,7 @@ Then add the plugin to your `webpack` config. For example:
29
29
** webpack.config.js**
30
30
31
31
``` js
32
- const CompressionPlugin = require (' compression-webpack-plugin' );
32
+ const CompressionPlugin = require (" compression-webpack-plugin" );
33
33
34
34
module .exports = {
35
35
plugins: [new CompressionPlugin ()],
@@ -129,7 +129,7 @@ The algorithm is taken from [zlib](https://nodejs.org/api/zlib.html).
129
129
module .exports = {
130
130
plugins: [
131
131
new CompressionPlugin ({
132
- algorithm: ' gzip' ,
132
+ algorithm: " gzip" ,
133
133
}),
134
134
],
135
135
};
@@ -259,7 +259,7 @@ For example we have `assets/images/image.png?foo=bar#hash`:
259
259
module .exports = {
260
260
plugins: [
261
261
new CompressionPlugin ({
262
- filename: ' [path][base].gz' ,
262
+ filename: " [path][base].gz" ,
263
263
}),
264
264
],
265
265
};
@@ -277,10 +277,10 @@ module.exports = {
277
277
// The `pathData` argument contains all placeholders - `path`/`name`/`ext`/etc
278
278
// Available properties described above, for the `String` notation
279
279
if (/ \. svg$ / .test (pathData .file )) {
280
- return ' assets/svg/[path][base].gz' ;
280
+ return " assets/svg/[path][base].gz" ;
281
281
}
282
282
283
- return ' assets/js/[path][base].gz' ;
283
+ return " assets/js/[path][base].gz" ;
284
284
},
285
285
}),
286
286
],
@@ -355,7 +355,7 @@ Enable file caching and set path to cache directory.
355
355
module .exports = {
356
356
plugins: [
357
357
new CompressionPlugin ({
358
- cache: ' path/to/cache' ,
358
+ cache: " path/to/cache" ,
359
359
}),
360
360
],
361
361
};
@@ -378,7 +378,7 @@ $ npm install @gfx/zopfli --save-dev
378
378
** webpack.config.js**
379
379
380
380
``` js
381
- const zopfli = require (' @gfx/zopfli' );
381
+ const zopfli = require (" @gfx/zopfli" );
382
382
383
383
module .exports = {
384
384
plugins: [
@@ -405,13 +405,13 @@ We can take advantage of this built-in support for Brotli in Node 10.16.0 and la
405
405
** webpack.config.js**
406
406
407
407
``` js
408
- const zlib = require (' zlib' );
408
+ const zlib = require (" zlib" );
409
409
410
410
module .exports = {
411
411
plugins: [
412
412
new CompressionPlugin ({
413
- filename: ' [path][base].br' ,
414
- algorithm: ' brotliCompress' ,
413
+ filename: " [path][base].br" ,
414
+ algorithm: " brotliCompress" ,
415
415
test: / \. (js| css| html| svg)$ / ,
416
416
compressionOptions: {
417
417
params: {
@@ -434,20 +434,20 @@ You can find all Brotli’s options in [the relevant part of the zlib module doc
434
434
** webpack.config.js**
435
435
436
436
``` js
437
- const zlib = require (' zlib' );
437
+ const zlib = require (" zlib" );
438
438
439
439
module .exports = {
440
440
plugins: [
441
441
new CompressionPlugin ({
442
- filename: ' [path][base].gz' ,
443
- algorithm: ' gzip' ,
442
+ filename: " [path][base].gz" ,
443
+ algorithm: " gzip" ,
444
444
test: / \. js$ | \. css$ | \. html$ / ,
445
445
threshold: 10240 ,
446
446
minRatio: 0.8 ,
447
447
}),
448
448
new CompressionPlugin ({
449
- filename: ' [path][base].br' ,
450
- algorithm: ' brotliCompress' ,
449
+ filename: " [path][base].br" ,
450
+ algorithm: " brotliCompress" ,
451
451
test: / \. (js| css| html| svg)$ / ,
452
452
compressionOptions: {
453
453
params: {
0 commit comments