Add support for serving gzipped static content. Between minification and

this, the client-size app is now about 1MB in size when built for production.
This commit is contained in:
Marsell Kukuljevic 2021-04-28 17:28:31 +02:00
parent 60a5cd91c8
commit 17e2a5f86a
2 changed files with 9 additions and 3 deletions

View File

@ -59,9 +59,14 @@ For development:
pushd app && ng build && popd
For production (shakes tree and minifies to get smaller size):
For production (shakes tree, minifies and gzips to get smaller size):
pushd app && ng build --prod && popd
pushd app
ng build --prod
for f in $(find dist -type f -not -name '*.html' -not -name '*.png'); do
gzip --best "$f";
done
popd
## Generate server certificates

View File

@ -200,7 +200,8 @@ function main() {
// where to serve static content from
let staticHandler = mod_restify.plugins.serveStatic({
directory: 'static',
default: 'index.html'
default: 'index.html',
gzip: true
});
server.get(STATIC_RE, function staticFunnel(req, res, next) {
staticHandler(req, res, function fileFound(err) {