Best practice to eliminate blank lines in HTML due to templating engines
Blank lines within and especially at the top of an HTML source file look
untidy to me.
A common template code (in this case, Jinja2) may look like this:
{% block header %}
{% include "templates/partials/something_header.html" %}
{% endblock header %}
{% block body %}
{% include "templates/partials/something_body.html" %}
{% endblock body %}
{% block footer %}
{% include "templates/partials/something_footer.html" %}
{% endblock footer %}
Now, without even adding indentation issues to make the above more
presentable, it already has the adverse effect of generating 2 empty lines
due to the 2 carriage returns within the templating code:
..
..
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv=....
Whilst I can utilize a minifier/post-processor in this particular case,
I'm wondering what others do to keep their template code easy on the eyes
whilst preventing unnecessary blank lines?
No comments:
Post a Comment