Compress your static website with gzip for faster serving with NGiNX's gzip_static on.
Project description
gzip_static
Compress your static website or website’s static assets with gzip for faster serving with nginx’s gzip_static module.
Nginx does not perform checks on the served gzip to determine if it is out of date. This program was created to automate the checks and compression of the static files at the website’s build time.
Features
Finds all static files in a directory and its subdirectories automatically based on an extensions file which can be customized.
Idempotent. Only compresses files that have not been compressed yet or are changed. Can therefore be used with configuration management systems such as Ansible.
Guards against serving outdated gzips
Gzip content is checked with a checksum to verify that a file has changed.
Has a --remove-orphans option to remove gzips for which the source static file is no longer available.
The created gzip files inherited filesystem attributes from the source static files such as the mode and the last modified time.
Works on any machine with Python 3.6 or higher installed. It does not depend on other packages for its core functionally.
Zopfli compression is supported when zopfli is installed.
Can be used as a library in other projects and has a fully documented API.
Optimized for checksumming small gzip file contents. Rerunning gzip_static on an already compressed website is very quick.
Quickstart
Install gzip_static with pip install gzip_static or pip install --user gzip_static. For more installation options and options to enable more functionally such as zopfli and better speed, checkout the installation documentation.
To compress all static files in a directory: gzip-static /var/www/my_example_website/
To check if all gzip files are up to date and recompress gzip files for which the source has changed: gzip-static /var/www/my_example_website/ (Same command due to idempotency)
To check if all gzip files are up to date, recompress changed ones and remove gzip files for which a source static file is no longer present: gzip-static --remove-orphans /var/www/my_example_website/
To check for orphaned files only: gzip-static-find-orphans /var/www/my_example_website/
For a more extended usage and more options use gzip-static --help or checkout the usage documentation.
Contributing
For bug reports and feature requests please use the github issue tracker. Pull requests are also welcome.
Please note that brotli support is currently not in this project’s scope. This may change. For more information read here.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gzip_static-0.1.0.tar.gz
.
File metadata
- Download URL: gzip_static-0.1.0.tar.gz
- Upload date:
- Size: 21.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d4a51b5d912256002dff060a6186d1efe24593c9b0f1a00335f5e3744e30909 |
|
MD5 | 92d4e2dee2b840091d4f36aaca354fb5 |
|
BLAKE2b-256 | c97ff06c4496487e11b021bb45c534739cbf34d96c54335ba77d71d9d0659081 |
File details
Details for the file gzip_static-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: gzip_static-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36e191dc71ef4076bd3da358b5401011bc487e5e223b9ed27691764cc338bb4d |
|
MD5 | 3ccff51620bd73ca295aa77fb649612e |
|
BLAKE2b-256 | 759f436c93a20a62e67af305091c5e1ed728ab63d47da4ae01e41aeea0d7c013 |