Multiple definitions of sprite
Munter opened this issue · 5 comments
I have a setup where sprite sheets are defined in sass files that are included in multiple other toplevel sass files. The result is that each output css file has a redefinition of the same sprite sheet. I hit the "Multiple definitions of spriteGroupName
sprite"-error.
Is there a way to avoid this?
Ideally I'd want assetgraph-sprite to handle this case more gracefully, but I'm also ok with having to do some manual workarounds in my assetgraph transform queue.
ping @papandreou
Just noticed you're not watching this repository :)
Hmm, could you post a complete example? It's happening because the compiled output of multiple .sass files end up including multiple occurrences of the same CSS rule with -sprite-selector-for-group: mySpriteGroup;
?
I guess an easy fix would be to only emit that warning if there are multiple incompatible definitions, and somehow make sure that the CSS rules are merged together otherwise.
Just noticed you're not watching this repository :)
Whoopsie. Fixed :)
exactly. Think of the spriting stylesheet as a sass partial that get included in multiple output css files, which I try to model in the same graph.
There are both duplicate -sprite-selector-for-group
-properties and implicit sprite declarations using the sprite=
url parametres.
I was wondering if I could just iterate over my css assets and call the spriting transform asynchronously for each of them in order to avoid the clash.
Would still be nice to see a complete, boiled down example, including the expected output. At least it would make it easier for me to picture exactly what's going on.
It sounds like you intend for all the images to be added to different sprites? Maybe it could be handled with a sass variable that holds the sprite group name, and then put that as the value of the sprite
parameter and -sprite-selector-for-group
value?
I think I reduced the error message as good as possible. Closing