{"id":28429594,"url":"https://github.com/mkrd/flask-squeeze","last_synced_at":"2025-07-21T03:02:41.047Z","repository":{"id":48368703,"uuid":"224402977","full_name":"mkrd/Flask-Squeeze","owner":"mkrd","description":"Automatically minify JS/CSS and compress all responses with brotli, defalte or gzip, with caching for static assets","archived":false,"fork":false,"pushed_at":"2025-06-30T07:40:14.000Z","size":972,"stargazers_count":14,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-30T08:40:58.646Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkrd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-11-27T10:17:05.000Z","updated_at":"2025-06-30T07:40:22.000Z","dependencies_parsed_at":"2022-09-13T15:21:27.659Z","dependency_job_id":"9a4b23c7-ddea-411c-b85d-a2dc7c438632","html_url":"https://github.com/mkrd/Flask-Squeeze","commit_stats":{"total_commits":137,"total_committers":4,"mean_commits":34.25,"dds":"0.25547445255474455","last_synced_commit":"3e935ba757ae5705c4008438b2c4a5fad0163f87"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/mkrd/Flask-Squeeze","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkrd%2FFlask-Squeeze","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkrd%2FFlask-Squeeze/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkrd%2FFlask-Squeeze/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkrd%2FFlask-Squeeze/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkrd","download_url":"https://codeload.github.com/mkrd/Flask-Squeeze/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkrd%2FFlask-Squeeze/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266231762,"owners_count":23896473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-05T13:38:30.134Z","updated_at":"2025-07-21T03:02:40.715Z","avatar_url":"https://github.com/mkrd.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Logo](https://github.com/mkrd/Flask-Squeeze/blob/master/assets/logo.png?raw=true)\n\n[![Downloads](https://pepy.tech/badge/flask-squeeze)](https://pepy.tech/project/flask-squeeze)\n![Tests](https://github.com/mkrd/Flask-Squeeze/actions/workflows/test.yml/badge.svg)\n![Coverage](https://github.com/mkrd/Flask-Squeeze/blob/master/assets/coverage.svg?raw=1)\n\nFlask-Squeeze is a Flask extension that automatically:\n- **Minifies** responses with JavaScript, CSS, and HTML content\n- **Compresses** all responses with brotli (preferred), gzip, or deflate compression based on browser support\n- **Protects** against the BREACH exploit by adding random padding to compressed responses\n- **Caches** static files so they don't need to be re-compressed, with both in-memory and persistent disk caching options\n- **Optimizes performance** with intelligent compression levels for static vs. dynamic content\n- **Works out-of-the-box** - no changes needed to your existing Flask routes or templates\n\nFiles are considered static if the substring \"/static/\" is in their request path.\n\n\nTable of Contents\n----------------------------------------------------------------------------------------\n- [Compatibility](#compatibility)\n- [Installation](#installation)\n- [Quick Start](#quick-start)\n- [Contributing](#contributing)\n\n\nCompatibility\n----------------------------------------------------------------------------------------\n\n- Tested with Python 3.8, 3.9, 3.10, 3.11, 3.12 and 3.13\n\n\nInstallation\n----------------------------------------------------------------------------------------\n\n```\npip install Flask-Squeeze\n```\n\n\nQuick Start\n----------------------------------------------------------------------------------------\n\n```python\nfrom flask import Flask\nfrom flask_squeeze import Squeeze\nsqueeze = Squeeze()\n\ndef create_app():\n    app = Flask(__name__)\n\n    # Init Flask-Squeeze\n    squeeze.init_app(app)\n\n    # Init all other extensions\n    # AFTER Flask-Squeeze\n\n    return app\n```\n\nThats it! The responses of your Flask app will now get minified and compressed, if the browser supports it.\nTo control how Flask-Squeeze behaves, the following options exist:\n\n\n### Basic Options\n| Option | Default | Description |\n| --- | --- | --- |\n| `SQUEEZE_COMPRESS` | `True` | Enable/disable compression |\n| `SQUEEZE_MIN_SIZE` | `500` | Minimum file size (bytes) to compress |\n| `SQUEEZE_CACHE_DIR` | `None` | Directory for persistent cache (`None` = in-memory only) |\n| `SQUEEZE_VERBOSE_LOGGING` | `False` | Enable debug output |\n\n### Minification Options\n| Option | Default | Description |\n| --- | --- | --- |\n| `SQUEEZE_MINIFY_CSS` | `True` | Enable CSS minification |\n| `SQUEEZE_MINIFY_JS` | `True` | Enable JavaScript minification |\n| `SQUEEZE_MINIFY_HTML` | `True` | Enable HTML minification |\n\n### Compression Levels\n| Option | Default | Range | Description |\n| --- | --- | --- | --- |\n| `SQUEEZE_LEVEL_BROTLI_STATIC` | `11` | 0-11 | Brotli level for static files |\n| `SQUEEZE_LEVEL_BROTLI_DYNAMIC` | `1` | 0-11 | Brotli level for dynamic content |\n| `SQUEEZE_LEVEL_GZIP_STATIC` | `9` | 0-9 | Gzip level for static files |\n| `SQUEEZE_LEVEL_GZIP_DYNAMIC` | `1` | 0-9 | Gzip level for dynamic content |\n\n### Example Configuration\n```python\napp.config.update({\n    'SQUEEZE_CACHE_DIR': './cache/flask_squeeze/',  # Enable persistent caching\n    'SQUEEZE_MIN_SIZE': 1000,  # Only compress files \u003e 1KB\n    'SQUEEZE_VERBOSE_LOGGING': True,  # Debug mode\n})\n```\n\n\nContributing\n----------------------------------------------------------------------------------------\n\n1. **Report bugs** by opening an issue\n2. **Submit pull requests** with improvements\n3. **Improve documentation**\n\n### Development Setup\n```bash\ngit clone https://github.com/mkrd/Flask-Squeeze.git\ncd Flask-Squeeze\nuv sync\njust test  # Run tests\njust run-test-app  # Run test app\n```\n\n\nLicense\n----------------------------------------------------------------------------------------\n\nMIT License - see [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkrd%2Fflask-squeeze","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkrd%2Fflask-squeeze","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkrd%2Fflask-squeeze/lists"}