Django template indentation guideline
There is PEP 8 for Python, but I haven't seen a preferred indentation
guideline for django templates.
What I mean is, I normally indent blocks like this:
<span>outside</span>
{% if condition %}
<span>within condition</span>
{% endif %}
<span>outside</span>
While this looks good on the editor, but it will look crap on view source
like this:
<span>outside</span>
<span>within condition</span>
<span>outside</span>
I would even look worse within the HTML indentation, see below:
<div>
<span>outside</span>
{% if condition %}
<span>within condition</span>
{% endif %}
</div>
will become:
<div>
<span>outside</span>
<span>within condition</span>
</div>
While I agree having better layout in editor is way way more important,
but I also get paranoid about the generated messy HTML source code.
No comments:
Post a Comment