News for hackers. Stuff that matters.
Re:A 14kb page can load much faster than a 15kb page by 8n4vidtmkvmk on Thursday August 25, 2022 @02:53AM (#32590457)
i too use an icon font, but if you want images you should use a spritemap. it shouldn't be sluggish.
Re:A 14kb page can load much faster than a 15kb page by EGreg on Thursday August 25, 2022 @07:39AM (#32592337)
I write a framework, not an app. In any event, I need to allow others to style my icons with their own colors. Hence I use a font. Is there a way to use SVG sprites or something, while also letting people control the stroke color with css? Seems yes: dont put CSS in the svg. But why not just use a font?

https://stackoverflow.com/questions/37940282/changing-the-st...

Re:A 14kb page can load much faster than a 15kb page by 8n4vidtmkvmk on Thursday August 25, 2022 @09:22PM (#32602239)
Yes, you can even put `color: currentColor` in your SVG file and then color it exactly the same way as your fonts (it'll use the current text color).

Why not? I don't know, you're asking the wrong person, I use a CSS font too. My reasons are (a) last time I looked into putting SVGs into a sprite-map to avoid 1000 HTTP requests it was a shitshow (not well supported), and (b) Chrome and other browsers would sometimes align the SVG on a half-pixel causes the edges to be a little blurry, whereas fonts get special treatment to ensure they are crisp. That was years ago tho.

Re:A 14kb page can load much faster than a 15kb page by kroltan on Thursday August 25, 2022 @08:16AM (#32592669)
If you can create a customized font file that is tiny and only has the icons you actually use, sure.

But the "wrong tool for the job" point still stands, users with custom fonts disabled (for performance or accessibility reasons) will not be able to see your icons.

Re:A 14kb page can load much faster than a 15kb page by easrng on Thursday August 25, 2022 @09:45AM (#32593624)
SVG with <use> tags should work perfectly.