cobrateam / django-htmlmin

HTML minifier for Python frameworks (not only Django, despite the name).
http://pypi.python.org/pypi/django-htmlmin
BSD 2-Clause "Simplified" License
542 stars 73 forks source link

DOCTYPE is always removed #89

Open uadnan opened 9 years ago

uadnan commented 9 years ago

After minifying it always removes <!DOCTYPE html> from top of html content that cause the Google Chrome to load all content as body.

Loading all content in Body leads to many errors by Angular JS Lazy Loader. Fix it

rubik commented 9 years ago

I encountered this bug as well. It's really a bummer. It strips away the doctype leaving just html.

rubik commented 9 years ago

Oh, the solution was trivial. In the middleware, replace response.content = html_minify(...) with response.content = str(html_minify(...)). I'm using Python 3 though, so str() is unicode.

LucasCTN commented 6 years ago

Can confirm, it removes the <!DOCTYPE html>. Unfortunately, adding str() on the middleware isn't working for me.