Nice! I'll try this tomorrow.
As you already said: until #22 is not implemented there is some gray area on how to manage the !important keyword for the attributes to set.
At this stage I'm just replacing the existing ones which have "background-image" attributes - and not the ones with the short syntax "background". But even when the "background:" attribute have the !important flag it should be preserved (that's relevant for #22).
For the current case - yes - your assumption should be right. Because the !important keyword overwrites effectively other definitions (added via css inheritance) - the background-image have to be in the right place - and that's only savely possible if you apply the !important keyword to the background-position attribute as well. Maybe it gets more complicated when there is also a "background-position" attribute in the original css with the keyword !important... which takes precedence? The one defined by the user or the one generated by SmartSprites? In the FAQ you advice that those attributes should be positioned before the SmartSprites-annotated background-image attribute. So I think currently the generated one overwrites the original position. I think that's ok.
Mmm... what about this case:
div.foo {
background-image: url(bar.jpg) !important; /** sprite-ref: hsprite; */
}
div {
background-position: -10px 20px;
}
The generated css by SmartSprites would be:
div.foo {
background-position: 0px 10px !important; /* example values - depending on the image dimensions */
background-image: url(hsprite.png) !important;
}
div {
background-position: -10px 20px;
}
The second definition would be overwritten by the !important keyword added by SmartSprites. So maybe this interferes the layout intended by the designer. So I think the FAQ should be extended by this issue. Overwriting styles via inheritance can not be detected by SmartSprites (because the reformating can occur in every style after and outside the currently processing style definition). And this is not just a problem when using the !important keyword. So when using SmartSprites - this fact should always be kept in mind.
Good point, Philipp! I can't think of an immediate workaround, but I'll try to fix this ASAP.