You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having some trouble getting the actual heights and widths of images within the sprite. I'm using the 2.0 branch, as I need the multi sprite support, but the following code throws an error for me;
image-height(sprite-file($sprite, $file));
In version 1, I would just use the $sprite variable as the reference to the sprite itself, but I can't quite figure out how to reference a sprite in 2.0. I've tried using the name that I added the sprite with in
retina-sprite-add(name, ... )
... but I still get an error telling me the first argument in sprite-file must be a sprite map.
How do I get the sprite map when using multiple sprites?
Cheers
The text was updated successfully, but these errors were encountered:
For those who might read this looking for an answer; my solution was to pinch some of the code within the extension and create the following;
// GET THE SPRITE MAP// Returns the sprite map so we can reference it to get other properties. Necessary due to multiple sprites// not having their own variable.// The code is pinched from the @mixin retina-sprite() in RSFCv2.0@functionget-retina-sprite-map($sprite-name) {
$index : 2;
$len : length($retina-sprite-names);
@for$ifrom$indexthrough$len {
@if$sprite-name==nth($retina-sprite-names, $i) {
$index : $i;
}
}
$sprite-map : nth($retina-sprite-sprites, $index);
@return$sprite-map;
}
The function gets the reference to the correct sprite, so we can then use it as follows;
I'm having some trouble getting the actual heights and widths of images within the sprite. I'm using the 2.0 branch, as I need the multi sprite support, but the following code throws an error for me;
In version 1, I would just use the $sprite variable as the reference to the sprite itself, but I can't quite figure out how to reference a sprite in 2.0. I've tried using the name that I added the sprite with in
... but I still get an error telling me the first argument in sprite-file must be a sprite map.
How do I get the sprite map when using multiple sprites?
Cheers
The text was updated successfully, but these errors were encountered: