I've been wondering about this a lot recently, what is exactly the purpose of Django's spaceless template tag?
Obviously it removes whitespaces from HTML tags, but other than that does it increase the speed at which the pages load?
What I mean to ask is, does removing whitespaces from html files help in any way?
A newline/space is a character, yes, and it will increase file size especially with large loops and human readability optimized template files (like a large FK list).
It's also exceedingly easy and safe to throw in {% spaceless %} in a base template.
It also lets you keep template code indented for readability but properly spaceless for HTML rendering (I'm thinking commas are a common scenario).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With