This consists of two scripts to create compressed copies of the original files using gzip/zopfli and brotli. Their mdates are set to that of the original file in order to detect if the original file has changed. Optionally, .js and .css files are first minified using the Yuicompressor. The original files always remain unchanged.
Please first check and adapt the configuration of the scripts to your needs.
Then, to compress an individual file: csa.sh /file/to/compress
Or, to recursively compress files in a directory tree: csa_rec.sh
As of version 2.0, the h2o webserver includes support for serving static files pre-compressed with the gzip or brotli compression algorithm. This allows to serve maximum compressed files without the computation overhead for on-the-fly compression, which is also available in h2o. For further information on compression in h2o, see https://h2o.examp1e.net/configure/compress_directives.html.
The scripts were written with portability in mind. However, version 0.1 has only been tested on FreeBSD. Addtional tests on GNU/Linux will follow.
csa is licensed under the 2-clause BSD license. Please feel free to contribute patches.