Glue is a simple command line tool to generate CSS sprites
github.com
github.com
http://www.nczonline.net/blog/2010/07/06/data-uris-make-css-...
this stack overflow answer brings up 2 possible drawbacks of a data-uri based approach: http://stackoverflow.com/a/3525961/897583 but it seems like if you are worried about your other css rules being blocked by your data-uri background-images, either put them in a css file that loads after your important rules, or just put them at the bottom of the css file. and it seems like with gzip the increase in size is negligible.
as far as keeping it simple, the sass file that I would write would look like:
.icon {
height: 16px;
width: 16px;
display: inline-block;
}
.checkmark-icon {
@extend .icon;
background-image: inline-image('path/to/checkmark.png');
&:hover { background-image: inline-image('path/to/checkmark-hover.png'); }
}
.error-icon {
@extend .icon;
background-image: inline-image('path/to/error.png');
&:hover { background-image: inline-image('path/to/error-hover.png'); }
}
so you'd never have to manually update the sass file if the image changes and then you can just do some magic to get it to work with ie7 with mhtml if you are going to support it.edit: oh, so i didn't fully grasp what your comment was saying. are you suggesting that you would use inline-image AND a sprite to put all the images into a sprite AND load that sprite inline with the css?
I'm not sure about the slightly larger filesize, but it's worth it for the other benefits.
Generating useful sprites is much harder than this guy thinks IMHO.
This should be interesting. CSS Spriting was made way manageable with Lemon, a Compass plugin which later became part of Compass Sprite.
The few limitations on the part of Compass Sprite, had always let me do my own sprite, I usually like those tightly packed image sprites.
Glue on the other hand generates the CSS for you, but expect you add a CSS class to the elements that should contain the sprites (or you can modify the generated CSS of course).