{% spaceless %} abuse (?)
hmm, kinda semi-noob, but heres my scenario
I just started working on a fairly large Django project thats been around for a couple years.
In the templates, I see a lot of use of {% spaceless %} tags whose apparent function is solely to trim whitespace to reduce page size/page load time or something.
That's not really what it was made for right? When I look at the original Django ticket thing here... https://code.djangoproject.com/ticket/1067, it dosent look like it, but I'm not 100% sure I guess
Also, beyond making the template code more unreadable too, I think using it too much could impact performance right? When I read at the django source for the spaceless tag, it eventually calls this function which does a regex replace of all whitespace in between the spaceless tags
# <django src>/utils/html.py:87
def strip_spaces_between_tags(value):
"""Returns the given HTML with spaces between tags removed."""
return re.sub(r'>\s+<', '><', force_unicode(value))
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home