pfalcon / utemplate

Micro template engine in Python with low memory usage, designed for Pycopy, a minimalist Python dialect, but also compatible with other Pythons.
https://github.com/pfalcon/pycopy
76 stars 8 forks source link

Packing of HTML and/or compression of longer HTML sections w/ zlib #15

Closed doc-hex closed 4 years ago

doc-hex commented 4 years ago

I would like my templates to be "packed" as they are compiled. This would be for the offline compiling mode (never on-device)... so, spaces and blanks would be removed from the HTML template just before it becomes bytecode. Unfortunately, reliably HTML compression (packing) is hard to get right, and in this case, we have template logic in there as well.

It would be hard to do, but it's a big win because I only need the extra whitespace in the HTML template for my personal comprehension during development.

What might be easier to implement, and would achieve (IMHO) similar compression rates, would be to run longer HTML sections through zlib. There's no need to do this for short strings, but when you have a wall of HTML, it will get good compression rates.

pfalcon commented 4 years ago

I'm sorry, but this looks like outside the scope of this project, which is, again, a minimalist template engine.