https://github.com/gera2ld/jinja2-htmlcompress
Compresses HTML in Jinja2 streams
https://github.com/gera2ld/jinja2-htmlcompress
Last synced: 8 days ago
JSON representation
Compresses HTML in Jinja2 streams
- Host: GitHub
- URL: https://github.com/gera2ld/jinja2-htmlcompress
- Owner: gera2ld
- License: other
- Created: 2016-07-26T12:40:10.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-26T13:10:02.000Z (almost 10 years ago)
- Last Synced: 2026-05-12T00:32:07.381Z (2 months ago)
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
jinja2-htmlcompress
===
A Jinja2 extension that removes whitespace between HTML tags.
Based on [mitsuhiko's jinja2-htmlcompress](https://github.com/mitsuhiko/jinja2-htmlcompress).
Installation
---
``` sh
$ pip3 install git+https://github.com/gera2ld/jinja2-htmlcompress.git
```
Usage
---
* Compress all HTML
``` python
env = Environment(extensions=['jinja2htmlcompress.HTMLCompress'])
```
* Compress partial HTML
``` python
env = Environment(extensions=['jinja2htmlcompress.SelectiveHTMLCompress'])
```
And then mark blocks with `{% strip %}`:
``` html
{% strip %} ... {% endstrip %}
```