File tree Expand file tree Collapse file tree 6 files changed +60
-27
lines changed Expand file tree Collapse file tree 6 files changed +60
-27
lines changed Original file line number Diff line number Diff line change
1
+ # Gzip Compression
2
+
3
+ Website gzip compression makes it possible to reduce the file size of a file
4
+ to roughly 30% of its original size before the files are sent to the browser.
5
+
6
+ It is enabled by default. To disable it set ` compresss ` option to ` false ` .
7
+
8
+ ## false
9
+
10
+ ** webpack.config.js**
11
+
12
+ ``` js
13
+ module .exports = {
14
+ // ...
15
+ devServer: {
16
+ compress: false ,
17
+ },
18
+ };
19
+ ```
20
+
21
+ Usage via CLI:
22
+
23
+ ``` console
24
+ npx webpack serve --open --no-compress
25
+ ```
26
+
27
+ ### What should happen
28
+
29
+ 1 . The script should open ` http://localhost:8080/ ` .
30
+ 2 . Files being sent to the browser from the ` webpack ` bundle should be gzipped.
31
+ 3 . Open the console in your browser's devtools and select the _ Network_ tab.
32
+ 4 . Find ` main.js ` . The response headers should not contain ` Content-Encoding: gzip ` .
33
+
34
+ ## Notes
35
+
36
+ Some browsers, such as Chrome, won't show the ` Content-Encoding: gzip ` within
37
+ the _ Response Headers_ . This has been documented [ here] ( https://github.com/expressjs/compression/issues/96 ) .
38
+
39
+ To enable ` Content-Encoding ` for _ Response Headers_ in Chrome, you can follow
40
+ [ this tutorial] ( https://www.youtube.com/watch?v=47R6uv0RKCk ) .
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ "use strict" ;
2
+
3
+ // our setup function adds behind-the-scenes bits to the config that all of our
4
+ // examples need
5
+ const { setup } = require ( "../../util" ) ;
6
+
7
+ module . exports = setup ( {
8
+ context : __dirname ,
9
+ entry : "./app.js" ,
10
+ devServer : {
11
+ compress : false ,
12
+ } ,
13
+ } ) ;
Original file line number Diff line number Diff line change @@ -31,32 +31,6 @@ npx webpack serve --open --compress
31
31
3 . Open the console in your browser's devtools and select the _ Network_ tab.
32
32
4 . Find ` main.js ` . The response headers should contain ` Content-Encoding: gzip ` .
33
33
34
- ## false
35
-
36
- ** webpack.config.js**
37
-
38
- ``` js
39
- module .exports = {
40
- // ...
41
- devServer: {
42
- compress: false ,
43
- },
44
- };
45
- ```
46
-
47
- Usage via CLI:
48
-
49
- ``` console
50
- npx webpack serve --open --no-compress
51
- ```
52
-
53
- ### What should happen
54
-
55
- 1 . The script should open ` http://localhost:8080/ ` .
56
- 2 . Files being sent to the browser from the ` webpack ` bundle should be gzipped.
57
- 3 . Open the console in your browser's devtools and select the _ Network_ tab.
58
- 4 . Find ` main.js ` . The response headers should not contain ` Content-Encoding: gzip ` .
59
-
60
34
## Notes
61
35
62
36
Some browsers, such as Chrome, won't show the ` Content-Encoding: gzip ` within
Original file line number Diff line number Diff line change
1
+ "use strict" ;
2
+
3
+ const target = document . querySelector ( "#target" ) ;
4
+
5
+ target . classList . add ( "pass" ) ;
6
+ target . innerHTML = "Success!" ;
Original file line number Diff line number Diff line change 2
2
3
3
// our setup function adds behind-the-scenes bits to the config that all of our
4
4
// examples need
5
- const { setup } = require ( "../util" ) ;
5
+ const { setup } = require ( "../../ util" ) ;
6
6
7
7
module . exports = setup ( {
8
8
context : __dirname ,
You can’t perform that action at this time.
0 commit comments