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:
parent
60a5cd91c8
commit
17e2a5f86a
@ -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
|
||||
|
||||
|
@ -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) {
|
||||
|
Reference in New Issue
Block a user