Skip to content

Commit 24d3447

Browse files
committed
nginx: serve gzip-compressed static files
Compress JS/CSS files with gzip after `yarn build` and configure nginx to serve the pre-compressed files. Closes #328
1 parent da6d2b7 commit 24d3447

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

nginx/reana-ui.conf

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ server {
33
root /usr/share/nginx/html;
44
server_name localhost;
55
index index.html index.htm;
6+
7+
#Enable serving of pre-compressed files
8+
gzip_static on;
9+
610
location / {
711
try_files $uri /index.html;
812
}

reana-ui/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"fmt": "prettier --write .",
3535
"ci": "run-p lint prettier",
3636
"eject": "craco eject",
37-
"postinstall": "semantic-ui-css-patch"
37+
"postinstall": "semantic-ui-css-patch",
38+
"postbuild": "find build \\( -name '*.js' -o -name '*.css' \\) -exec gzip -k9S .gz {} \\;"
3839
},
3940
"browserslist": {
4041
"production": [

0 commit comments

Comments
 (0)