vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
616 stars 167 forks source link

Include Brotli compression into the Maven plugin workflow #3765

Closed Legioth closed 6 years ago

Legioth commented 6 years ago

As part of implementing https://github.com/vaadin/flow/issues/3764, we would add support for automatically serving precompressed Brotli files whenever appropriate. With generic serving support implemented, we could also update the Maven plugin to produce .br files for the bundle files. It seems like gulp support already exist for this, so it's possible that it's quite easily integrated.

As an example of the benefits, the bundle size for Patient Portal is 1062k uncompressed, 315k gzipped and 254k with Brotli, thus reducing the compressed size by about 20%.

Legioth commented 6 years ago

As an alternative to integrating this on the gulp side, there's also a Maven plugin that can be used to do the same work: https://github.com/RyanHoldren/ResourceCompressor.

A Maven plugin would on the other hand either require additional configuration in each application's pom.xml, or integration into the Maven plugin.

Legioth commented 6 years ago

Turns out that the default setup doesn't even gzip the production bundle, so should do that as well at the same time.

Legioth commented 6 years ago

Without any precompressing, the production bundle for the Beverage buddy starter is 729kb and takes 4.65s to load with the Fast 3G profile in Chrome. Precompressing with gzip reduces the size to 191kb and the time 1.79s. Brotli further reduces this to 153kb and 1.60s.