Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Not sure if this is the case or not, but certain templating systems make it really hard to remove extra whitespace/lines (I'm looking at you Jinja2) and they get added when you use standard templating stuff like "if/then" statements.

Removing them after the fact with a HTML tidier would work, or you could just not care and let gzip handle the compression.



> Not sure if this is the case or not, but certain templating systems make it really hard to remove extra whitespace/lines (I'm looking at you Jinja2)

Jinja2 is a generic templating engine, and as such can't make assumptions about relevance of whitespace.

However, writing an extension on top of it isn't hard, and mitsuhiko has written an extension to do that.

https://github.com/mitsuhiko/jinja2-htmlcompress


Nice! Going to integrate this into my blogofile setup so that I can output nicer HTML!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: