-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<!-- | ||
kb_guide | ||
kb_pwa | ||
kb_everyone | ||
kb_sync_latest_only | ||
--> | ||
|
||
# Optimizations | ||
|
||
## Nginx Optimizations | ||
|
||
The Nginx building block applies: | ||
|
||
- Compression of responses | ||
- PageSpeed optimization | ||
|
||
for further information, please refer to the [Guide - Building and Running nginx][nginx-startup]. | ||
|
||
## Custom Webpack Build | ||
|
||
The PWA uses a customized webpack build, that opens the doors to additional optimizations. | ||
The build can be customized in the file [`webpack.custom.ts`](../../templates/webpack/webpack.custom.ts). | ||
|
||
If the PWA is built using `production` configuration. (Either by building with `--configuration=<other>,production` or by building the docker image with `--build-arg configuration=<other>,production`), the following optimizations are applied: | ||
|
||
- Angular CLI [build-optimizer](https://github.com/angular/angular-cli/tree/master/packages/angular_devkit/build_optimizer#angular-build-optimizer) | ||
- Webpack [SplitChunksPlugin](https://webpack.js.org/plugins/split-chunks-plugin/) is instructed to produce only `main`, `vendor`, `polyfills` and one `common` bundle for the code for optimized compression and download of the application. | ||
- All `data-testing` attributes are removed from the HTML templates to reduce output. | ||
|
||
## CSS Optimization | ||
|
||
On npm `postbuild`, we integrated [PurgeCSS](https://purgecss.com) to remove unused CSS classes from the CSS output. | ||
[Configuration](https://purgecss.com/configuration.html), especially whitelisting certain classes, can be done in [`purgecss.config.js`](../../purgecss.config.js). | ||
|
||
# Further References | ||
|
||
- [Guide - Building and Running nginx Docker Image][nginx-startup] | ||
|
||
[nginx-startup]: ./nginx-startup.md |