https://discord.umbraco.com logo
I got a bit carried away trying to
# show-and-tell
d
I got a bit carried away trying to synchronise iconography that gets used on block grid items through to contentment pickers for picking blocks to then display them in the front end website using custom SVGS. I'm really pleased with the results But at the moment the front end resolver is reading from SVG files off discs and the next logical step would be to get it to read from Umbraco's icon registry. it does mean there's a single source of truth but I don't know yet if IIconService can see icons registered via the icons extension type. Wish me luck! https://cdn.discordapp.com/attachments/905057811682193429/1494257063562576003/image.png?ex=69e495d5&is=69e34455&hm=22309be4d11d296a4f2a064e2dff4662739cfd459b4729d6e7ea40fb5e9b6698& https://cdn.discordapp.com/attachments/905057811682193429/1494257063935741983/image.png?ex=69e495d5&is=69e34455&hm=2f6bc0a28ae1481bc1b159555db9369548d573912cd552898d23da76b5dabd9b&
a
You dont want them reading directly of disc, atleast not on every request. Better to make it a sprite (single load) and reference the singular svgs (same as I do in my iconpicker package: https://github.com/Ambertvu/Umbraco.Community.IconPicker)
Perhaps you can load them in the backoffice too in a similar way so it can be used in blocks ?
Or as an extension on the package 😉
d
Thanks @Ambert I have updated it since so to clarify, the SVGs aren't being read from disk per request; they're cached in memory once (Lazy<> on a dictionary keyed by block grid alias), then referenced by that same field the backoffice uses for the thumbnail. So editor and frontend are already pulling from one source. However, they do end up inlined in the HTML rather than referenced from a sprite, which is a valid point for sites with lots of icons per page but for our volume it's fine. Appreciate the IconPicker link though and I am sure it will be useful. I have noticed a few icon packages lately.
a
Sounds good!
TBH, even for two icons it's nice to load it as a sprite, because of non-dupilation of html 🙂
d
Oh don't get me wrong I used to use sprites for all sorts in the old days. I used to hand draw sprite sheets for animations on JS and then CSS hover for icons.
s
Duplication is not a problem if you compress your pages. Sprites can end up loading unnecessary icons
3 Views