{"id":29865647,"url":"https://github.com/zaczero/jinja2-htmlmin","last_synced_at":"2025-10-08T08:24:16.154Z","repository":{"id":307132256,"uuid":"1028525721","full_name":"Zaczero/jinja2-htmlmin","owner":"Zaczero","description":"Automatic HTML minification for Jinja2 templates","archived":false,"fork":false,"pushed_at":"2025-07-29T17:07:12.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-29T17:44:43.940Z","etag":null,"topics":["fastapi","html","html-minifier","htmlmin","jinja2","minification","starlette","templates"],"latest_commit_sha":null,"homepage":"https://pypi.org/p/jinja2-htmlmin","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Zaczero.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":"2025-07-29T16:54:33.000Z","updated_at":"2025-07-29T17:07:16.000Z","dependencies_parsed_at":"2025-07-29T17:44:50.550Z","dependency_job_id":"bf1055b5-eba7-42b8-9f5b-e05def9e2db7","html_url":"https://github.com/Zaczero/jinja2-htmlmin","commit_stats":null,"previous_names":["zaczero/jinja2-htmlmin"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Zaczero/jinja2-htmlmin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zaczero%2Fjinja2-htmlmin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zaczero%2Fjinja2-htmlmin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zaczero%2Fjinja2-htmlmin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zaczero%2Fjinja2-htmlmin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zaczero","download_url":"https://codeload.github.com/Zaczero/jinja2-htmlmin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zaczero%2Fjinja2-htmlmin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267858397,"owners_count":24155919,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["fastapi","html","html-minifier","htmlmin","jinja2","minification","starlette","templates"],"created_at":"2025-07-30T11:13:16.836Z","updated_at":"2025-10-08T08:24:11.131Z","avatar_url":"https://github.com/Zaczero.png","language":"Python","funding_links":["https://liberapay.com/Zaczero/","https://github.com/sponsors/Zaczero"],"categories":[],"sub_categories":[],"readme":"# jinja2-htmlmin\n\n[![PyPI - Python Version](https://shields.monicz.dev/pypi/pyversions/jinja2-htmlmin)](https://pypi.org/p/jinja2-htmlmin)\n[![Liberapay Patrons](https://shields.monicz.dev/liberapay/patrons/Zaczero?logo=liberapay\u0026label=Patrons)](https://liberapay.com/Zaczero/)\n[![GitHub Sponsors](https://shields.monicz.dev/github/sponsors/Zaczero?logo=github\u0026label=Sponsors\u0026color=%23db61a2)](https://github.com/sponsors/Zaczero)\n\nAutomatic HTML minification for Jinja2 templates.\n\n## Why Use This?\n\n- **Zero runtime overhead**: Minification happens once at load time, not on every render\n- **Smaller HTML**: Reduced bandwidth and faster page loads\n- **Drop-in compatibility**: Works with any Jinja2 loader (Flask, Django, FastAPI, etc.)\n- **Broad Python support**: Compatible with Python 3.9+\n- [**Semantic Versioning**](https://semver.org): Predictable, reliable updates\n- [**Zero-Clause BSD**](https://choosealicense.com/licenses/0bsd/): Public domain, use freely anywhere\n\n## Installation\n\n```bash\npip install jinja2-htmlmin\n```\n\n## Quick Start\n\n```python\nfrom jinja2 import Environment, FileSystemLoader\nfrom jinja2_htmlmin import minify_loader\n\n# Wrap any Jinja2 loader\n# See https://htmlmin.readthedocs.io/en/latest/reference.html for options\nenv = Environment(\n    loader=minify_loader(\n        FileSystemLoader(\"templates\"),\n        remove_comments=True,\n        remove_empty_space=True,\n        remove_all_empty_space=True,\n        reduce_boolean_attributes=True,\n    )\n)\n\n# Rendered HTML is automatically minified\nhtml = env.get_template('index.html').render(title='My Page')\n```\n\n## How It Works\n\n1. Template loads normally through your existing loader\n2. Jinja2 syntax is temporarily protected during minification\n3. HTML content is minified using [htmlmin2](https://github.com/wilhelmer/htmlmin)\n4. Jinja2 syntax is restored and template compiles as usual\n5. Jinja2's built-in caching means this happens only once per template\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaczero%2Fjinja2-htmlmin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzaczero%2Fjinja2-htmlmin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzaczero%2Fjinja2-htmlmin/lists"}