Skip to main content
https://codecov.io/gh/rhpvorderman/gzip_static/branch/main/graph/badge.svg?token=NFFZIBF1ZA

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.

Metadata

Release files for gzip-static 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gzip-static 0.1.0
File Size Uploaded
gzip_static-0.1.0.tar.gz 21.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gzip-static 0.1.0
File Interpreter ABI Platform
gzip_static-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 42.4 kB

Release files / gzip_static-0.1.0.tar.gz

Download URL gzip_static-0.1.0.tar.gz
Size 21.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3d4a51b5d912256002dff060a6186d1efe24593c9b0f1a00335f5e3744e30909
BLAKE2b-256 checksum
How to use checksums
c97ff06c4496487e11b021bb45c534739cbf34d96c54335ba77d71d9d0659081
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / gzip_static-0.1.0-py3-none-any.whl

Download URL gzip_static-0.1.0-py3-none-any.whl
Size 20.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36e191dc71ef4076bd3da358b5401011bc487e5e223b9ed27691764cc338bb4d
BLAKE2b-256 checksum
How to use checksums
759f436c93a20a62e67af305091c5e1ed728ab63d47da4ae01e41aeea0d7c013
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page