Brotli
Pre-compress static assets with Brotli and Gzip
Let's make the web a smaller place by pre-compressing static assets with Brotli and Gzip. Here are some useful tips to get started.
Summary
Gzip
Gzip is well-known and around for some time. Almost all web clients support it and the savings are typically very high.
Compressing a file with gzip is simple, especially with the command often already installed on Linux systems.
gzip --best --force filename.html
This compresses the file as good as it can (–best) and overwrite a .gz file if it already exists (–force).
Brotli
Brotli is a fairly new kid on the block when it comes to compressing files. So besides having Gzip, it is a good idea to pre-compress files also with Brotli. The files are generally smaller than those compressed with Gzip.
How to test if a website supports Brotli or Gzip compression
Optimizing a web server and its content can be done using brotli and gzip compression. This article shows a few ways to test your website.
Summary
After migrating this blog to Hugo we performed some optimization steps to ensure it is as quick as possible. Pages are slim and small in size, but still can be compressed. Normally we would do this on the end of the web server, by enabling dynamic compression. So each time a client requested a compressed page, the web server would compress is and send over the data. This time we turned things around.