A Metalsmith plugin that creates gzipped copies of the site's content. This is useful for website hosting on Amazon S3, where on the fly compression in the server is impossible.
$ npm install metalsmith-gzip
var Metalsmith = ;var compress = ;var metalsmith = __dirname;
metalsmith-gzip will gzip a file if the extension matches this regular expression:
The choice of files to compress is loosely based on the HTML5 Boilerplate server configuration.
Pass an options object to customize metalsmith-gzip behaviour. These are the available options keys:
src is a multimatch pattern which specifies which types of files to compress.
gzip is the same configuration object accepted by
zlib.createGzip (http://nodejs.org/api/zlib.html#zlib_options). For example, you can set the compression level:
You need to create a script to upload the gzipped versions of the files to your preferred hosting provider yourself. Take care to serve the files with the correct Content-Encoding.
This plugin was inspired by the Middleman gzip extension.