Compress and minify Flask responses!
Project description
Flask-Squeeze
Flask-Squeeze is a Flask extension that automatically:
- Minifies your JS and CSS files.
- Compresses all HTTP responses with brotli.
- Caches static files so that they don't have to be recompressed. The cache will be cleared each time Flask restarts!
Installation
pip3 install Flask-Squeeze
Usage
from flask_squeeze import Squeeze
squeeze = Squeeze()
# Initialize Extension
squeeze.init_app(app)
Thats all!
Options
You can configure Flask Squeeze with the following options:
COMPRESS_FLAG (default=True)
: Globally enables or disables Flask-SqueezeCOMPRESS_MIN_SIZE (default=500)
: Defines the minimum file size in bytes to activate the brotli compressionCOMPRESS_LEVEL_STATIC (default=11)
: Possible value are 0 (lowest) to 11 (highest). Defines the compression level of brotli for files in static folders. Theses files fill also be cached, so that they only have to be compressed once.COMPRESS_LEVEL_DYNAMIC (default=5)
: Possible value are 0 (lowest) to 11 (highest). Defines the compression level of brotli for dynamic files like generated HTML files. Theses files will not be cached, so they will be compressed for each response.
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
Flask-Squeeze-1.6.tar.gz
(2.6 kB
view hashes)
Built Distribution
Close
Hashes for Flask_Squeeze-1.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 434eba0735b04a66fc3a81170527ece6576a75507372cb176072942b9601f3b6 |
|
MD5 | 493c01ec97f5d43497a5509badfdb06c |
|
BLAKE2b-256 | c8021e987760b22af6d9ab3a834749e620cf28b72b3960a0a877340880320d90 |