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

83 views
Skip to first unread message

Farsheed Ashouri

unread,
Oct 21, 2011, 10:41:50 AM10/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, 9:40:30 AM10/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, 9:59:30 AM10/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, 12: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, 1: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