-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Icon #969
Icon #969
Conversation
@todo
Potential icon sets:
Of these sets, Ionicons and Bootstrap would probably be the easiest to add/maintain as submodules since they have a simpler directory structure. Example Usage and DetailsSome sets, such as Ionicons, use a dash-suffix for variants (e.g. sharp, outline). Depending on the chosen set, the
Example HTML OutputUnlike SVGs displayed via an
Default CSSFor most themes (including admin), this would probably be a sufficient base...
|
I'm wondering about a couple things here:
|
Function nameI could see changing the function name if that's something that makes sense on your end. PerformanceAs far as markup size, I had the same thought until I compared inline SVG to the cost of Font Awesome. For instance, I have a page that uses 16 SVG icons (navigation stuff, social icons, etc). They add up to about 8.5Kb. The FA WOFF included in Omeka admin is about 75Kb, plus a little more for the required CSS. Then there's the cost of the multiple network requests for FA. I don't know how that compares to the cost of reading a bunch of SVGs but without doing a lot of server-side tests, I'd venture that all things considered it's probably faster to read the files than to fetch/embed the font. But I could be wrong. So far, I've just been trying to reduce network requests and optimize the overall size of the delivered page. VariantUltimately, not a big deal either way since, as you note, it's easy enough to accomplish the desired outcome without it. Will remove, along with the README file and example icons. |
The issue on transfer size is that you pay that cost once per user with the webfont, then it's cached, while the increased page size is there for every request in the inline-SVG world. So I'm not quite sure how to best compare that. Using the SVGs just as regular images seems to forfeit the benefits of being able to CSS-style them and so on, and yes would result in additional round-trips for each unique icon at least once, which is probably not great. The "sprite" solution avoids both of these by not duplicating the icon markup when it's used multiple times within a page but also not incurring a bunch of extra requests... but it's more complicated to do. I think you can just load an external SVG and still use it as "sprites" and keep the styling benefits, though I imagine that gets you back into a similar transfer-size space as the webfont did originally. A hybrid approach where this function notices you using an icon more than once and kind of "sprites" it for you could be the best of both worlds, so rather than outputting the full markup every time, the icon markup only is output once and later instances of it (or all instances of it) are |
Agreed, some solution that allows for caching would be ideal. I'll look into this some more and see if there's something I can contribute that strikes the right balance. Feel free to close this PR if you like, or I can come back to it later. |
This adds a simple
icon()
function, three example icons (from @ionic-team/ionicons), and a README file containing rationale, usage examples, and a few other considerations.#967