1

I have a cherrypy web server that uses larges amounts of HTML data. Is there anyway in Python to minimize the HTML so that all comments, spaces, ext, are removed?

3 Answers 3

4

Not what you mean, but: Gzip. (Assuming you aren't already serving through a compressing front-end.) Compression will zip away whitespace to almost nothing; unless you have excessively large comments this will be more effective than minification.

Sign up to request clarification or add additional context in comments.

Comments

2

there are bindings to tidy for python, called mxTidy from eGenix (Marc André Lemburg)

Comments

0

HTML Tidy's libtidy doesn't seem to have python bindings (bit it does have perl and c++ etc), but ought to be easy to run as an exe in a pipe.

Or ideally, use it to 'tidy' all static html files once so they don't need to be tidied each time they are served.

1 Comment

That page links to a TidyLib Python wrapper: utidylib.berlios.de but I don't know if it minifies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.