django-htmlmin
django-htmlmin copied to clipboard
White spaces between <a> tags not being removed
I have found that when I write something like this:
<div>
<a>
Something
</a>
<a>
Something
</a>
</div>
The result is:
<div><a>Something</a> <a>Something</a></div>
Instead of:
<div><a>Something</a><a>Something</a></div>
as I expected.
Is there any reason for this? Or it's a bug?
I believe that it is a bug.
Seeing as tags are inline elements, I can't see how this is a bug.
If your initial code was <div><a>Something</a> <a>Something</a></div>
you wouldn't expect the space to be removed, so how is the minifier to know that you do want the whitespace removed from your example?
Hmmm... ok. The thing is that, in my production server, nginx is minifying html in a way that removes the spaces. My goal was to use this tool in order to simulate the nginx minification locally and write my styles according to that in order to avoid unexpected results that otherwise would be hidden to me until seeing the page in production.
But you're right, maybe the bug is in the way that nginx minifies html or maybe there is a configuration option I couldn't find
this is not a bug! If you render
<div>
<a>
Something
</a>
<a>
Something
</a>
</div>
in a browser it shows Something Something
If it changes the content to SomethingSomething
it is definitly a bug in the nginx thing.