Is it possible to compress the output html before rendering out?

82 views
Skip to first unread message

Farsheed Ashouri

unread,
Oct 21, 2011, 2:41:50 PM10/21/11
to web...@googlegroups.com
Is it possible to compress the output html before rendering out? I mean
using tools like compressors or tiddy to clean/compress the output code
automatically on output not on our source.

Marco Tulio Cicero de M. Porto

unread,
Oct 27, 2011, 1:40:30 PM10/27/11
to web...@googlegroups.com
like the uglifier on Ruby?

2011/10/21 Farsheed Ashouri <farsheed...@gmail.com>

Is it possible to compress the output html before rendering out? I mean
using tools like compressors or tiddy to clean/compress the output code
automatically on output not on our source.




--
[]'s
Marco Tulio

Anthony

unread,
Oct 27, 2011, 1:59:30 PM10/27/11
to web...@googlegroups.com
If you have a function that does the compressing, I suppose you could do something like:

def my_action():
    [some code]
    d = dict(...)
    return compress_html(response.render(d))

Anthony

Francisco Costa

unread,
Sep 11, 2014, 4:38:05 PM9/11/14
to web...@googlegroups.com
tried with https://pypi.python.org/pypi/htmlmin/0.1.5 and worked fine

Leonel Câmara

unread,
Sep 11, 2014, 5:21:31 PM9/11/14
to web...@googlegroups.com
Make sure you profile stuff before making all your controllers "ugly". Configure your servers to gzip the contents, use response.optimize_js and response.optimize_css. That may be enough.

Anyway, do profile before and after this change there may not be much to gain by minifying the HTML.
Reply all
Reply to author
Forward
0 new messages