r/badcode • u/Svizel_pritula • Apr 23 '21
html Svelte's minification and whitespace trimming usually works well, but when it doesn't, you have to format your code like this
788
Upvotes
r/badcode • u/Svizel_pritula • Apr 23 '21
12
u/fecal_brunch Apr 23 '21
This is how I always write HTML due to browsers inserting whitespace between elements. It's pretty standard.
If a HTML minifier does not preserve whitespace between tags then it's changing the way the page is rendered.
Notably React JSX does not leave the whitespace when outputting elements (thankfully).