Search code examples
compass-sass

Getting only x or y position from sprite in compass?


If I use

@import "icon/*.png";
@include all-icon-sprites;

I can use

background-position: sprite-position($icon, foobar);

to get the xy position of the foobar-icon. Is it possible to get only the x or y value within the sprite?


Solution

  • Try this.

    $x: nth(sprite-position($icon, foobar), 1);
    $y: nth(sprite-position($icon, foobar), 2);