Skip to content
This repository has been archived by the owner on Feb 20, 2019. It is now read-only.

Latest commit

 

History

History

compress-with-brotli-and-gzip

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Compress with Brotli and Gzip

Functionality

Compress static files with Brotli and Gzip using maximum compression. This greatly reduces file size. Which means files can download much faster. For more background read our blog post on static site implosion with Brotli and Gzip.

Usage

Install dependencies

All dependencies needed to run the tests are pre-configured in package.json. You just need to install these:

npm install

Note: it's smart to update to the latest versions of these dependencies.

Configure in- and output directory

Adjust the inputDir and outputDir in scripts/compress.js (both default to dist/).

Run compress script

Compress all files in inputDir and write to outputDir:

npm run compress

Note: This setup contains an example file in dist/examples/. As this setup uses the inputDir as the outputDir the compressed files are placed right next to the original.

Configure server to use precompressed files

You'll need to configure your server to serve the precompressed files when available. In addition you can enable on-the-fly compression of dynamic assets.

More resources