We have some sprites in core and we'll have more:
#851496: Invalid to use the CSS background to display non-background images in Forum
#821672: Forum icons not accessible to screen-reader users
#1849078: Replace many toolbar icon files with a single CSS sprite image
#565752: Core images (i.e. images in /misc) should use CSS sprites
There are some new best practices that should be considered
http://www.paciellogroup.com/blog/2012/08/notes-on-accessible-css-image-...
http://openweb.eu.org/articles/performances_web_les_sprites_CSS
And how we approach this needs to be consistent so that it is easy for modules to adopt this best practice moving forward.
Comments
Comment #1
nod_tag
Comment #2
mgiffordtagging.
Comment #3
sunWasn't Assetic supposed to help with that?
Sprites are not compatible with a modular system architecture — in an ideal world, Sprites would be auto-generated and injected into CSS files during CSS preprocessing. That keeps the concept compatible with a modular/theme-overridable architecture, and allows sites to leverage Sprites and improve frontend performance in a much more generic way.
In the past, this has been approached in http://drupal.org/project/sprites and I think some other contrib modules already. I don't know whether they have been successful.
Comment #4
nod_Assetic would help only by enabling the use of Compass/SASS, not as the thing actually building the sprite.
Comment #5
barraponto CreditAttribution: barraponto commentedwill we get around to adding a spriting library by feature freeze? SASS/Compass is out of the game for d8 (unfortunately) but what about PHP spriting libraries? although I expect them to generate css of their own.
Comment #6
droplet CreditAttribution: droplet commentedJust a note:
When doing sprties, please leaves more spaces between each image. and test it with/without GPU enabled.
#1069152: Throbber in textfield is misaligned when browser hardware acceleration enabled (gfx)
Comment #7
ry5n CreditAttribution: ry5n commentedTwo things:
1. Just FYI, Compass actually does build sprites, from a directory of separate image files: http://compass-style.org/help/tutorials/spriting/
2. There’s another relevant issue with a solid proposal that would handle this, but it’s hung up on some theme system internals: https://drupal.org/node/1849712
Comment #7.0
mgiffordUpdated issue summary with 1849078
Comment #7.1
mgiffordadding 565752
Comment #8
mgiffordI'm assuming this should get bumped to 8.1.x.
Comment #9
mgiffordComment #25
mgiffordMight want to consider moving to SVG sprites
https://www.sitepoint.com/use-svg-image-sprites/
https://css-tricks.com/svg-sprites-use-better-icon-fonts/
There are definitely language and accessibility challenges though.
One way around this is:
https://upload.wikimedia.org/wikipedia/commons/1/1e/Multilingual_SVG_exa...
https://developer.mozilla.org/en-US/docs/Web/SVG/Element/switch#SVG_%3Cs...
But that doesn't cover title/desc.