Problem/Motivation
At the moment we handle icons with different colours by having several different folders with alternate versions of SVGs:
.toolbar-bar .toolbar-icon-menu:before {
background-image: url("../../../misc/icons/bebebe/hamburger.svg");
}
.toolbar-bar .toolbar-icon-menu:active:before,
.toolbar-bar .toolbar-icon-menu.active:before {
background-image: url("../../../misc/icons/ffffff/hamburger.svg");
}
I was about manipulating svg icons with css and it seems like a way to reduce page weight and improve maintenance. The potential here is exciting:
The big difference is instead of including the SVG as a CSS background image you have to embed it into the HTML. This looks quite simple to do in PHP but it would be nice to have some way of handling this easily in the theme system.
Browser support for inline svg is not that different to svg, Opera Mini does not support it though.
Proposed resolution
Let's see how feasible and desirable it is to shift svg inline
Remaining tasks
- Discuss advantages and disadvantages
- Proof of concept patch
User interface changes
API changes
Comment | File | Size | Author |
---|---|---|---|
css-icons.gif | 287.17 KB | LewisNyman |
Comments
Comment #1
xmacinfoIndeed! Adding a related issue.
Comment #2
xmacinfoComment #3
pixelwhip CreditAttribution: pixelwhip commentedHere's some quick and not necessarily comprehensive thoughts.
Advantages
Disadvantages
My hunch is that the disadvantages are performance related. Those are probably negligible when compared to sprites, but that can and should be tested. As you pointed out, there is about a 3% difference in browser support which looks like it's mainly due to Opera Mini. Seems like the styling advantages would be worth it.
Comment #4
Wim LeersIf/when we do this, this issue should definitely handle the toolbar icons (see #1849078: Replace many toolbar icon files with a single CSS sprite image for prior discussion, from #41 and later).
Comment #5
droplet CreditAttribution: droplet commentedComment #6
jwilson3Working now on an SVG guideline doc... your contributions and input/feedback are welcome: #2433761: [meta] svg guidelines / requirements Thanks!
Comment #7
andrewmacpherson CreditAttribution: andrewmacpherson as a volunteer commented