3 ms·
I’m personally more annoyed at the SVG pollution in modern day frontends. I’m not saying I hate SVGs but why in the heck are we producing 10k like html files by
by djfobbz 4y ago
I’m personally more annoyed at the SVG pollution in modern day frontends. I’m not saying I hate SVGs but why in the heck are we producing 10k like html files by incorporating SVG paths directly into the HTML? There should be a standardized browser protocol to be able to insert SVG via filename and pass it any styling references.
- hbn 4y agoWhat's wrong with having the SVG embedded in the HTML? Someone who knows more about the inner workings of network technologies can correct me if I'm wrong, but I would have figured it's better to send a single large file than a bunch of smaller files.
- SuperCuber 4y agoApparently HTTP2 makes multiple small files much less of a performance issue (or maybe even turns it into a performance gain, I haven't looked into it too closely)
- djfobbz 4y agoSee example here: https://imgur.com/a/XMEkAu1 https://imgur.com/a/XMEkAu1 it's 28 lines total...1 button + 2 svg images, should total 6 lines of code tops! This is my frustration and this is what I call SVG pollution.
- hbn 4y agoIt's 28 lines because it's formatted to have every attribute on a different line. I'd put the <svg> tag and all its attributes on a line, the entirety of the path on a single line, and then with the closing </svg> tag it's reduced to 3 lines. This is how I do embedded SVGs: https://imgur.com/a/zVVEVps https://imgur.com/a/zVVEVps Note your example also looks way worse because of line wrap