Swaagie / minimize

Minimize HTML
MIT License
162 stars 18 forks source link

Support for django template tags #60

Closed callmiy closed 9 years ago

callmiy commented 9 years ago

I have in my django template: <input type="checkbox" {% if not conts %}disabled="true"{% endif %}>

and when minified, I get: <input type=checkbox {%="" if="" not="" conts="" %}disabled=true endif="" %}="">

I have set "quotes" to false, but still get same output. How do I fix this?

Swaagie commented 9 years ago

The easiest fix is to minify content after the template has been parsed. Simply because the template itself does not represent valid HTML which the Domparser of htmlparser2 can parse. The only way to fix this would be to create a custom domparser or rather django-domparser in this case.

callmiy commented 9 years ago

Thanks @Swaagie. I actually got it working by changing my markup to look like this <input type="checkbox" disabled="{% if not conts %}true{% endif %}">

Swaagie commented 9 years ago

That makes sense, thanks for replying :)