Skip to content

Instantly share code, notes, and snippets.

@julienbourdeau
Created October 13, 2012 11:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julienbourdeau/3884282 to your computer and use it in GitHub Desktop.
Save julienbourdeau/3884282 to your computer and use it in GitHub Desktop.
Sprite with LESScss from smashing mag
.spriteHelper(@image, @x, @y, @spriteX, @spriteY) {
background: url("img/@{image}.png") no-repeat;
background-position: -(@x*@spriteX) -(@y*@spriteY);
}
.sprite(@image, @x, @y) when (@image = sprite1), (@image = sprite3){
@spriteX: 32px;
@spriteY: 16px;
.spriteHelper(@image, @x, @y, @spriteX, @spriteY);
}
.sprite(@image, @x, @y) when (@image = sprite2){
@spriteX: 64px;
@spriteY: 32px;
.spriteHelper(@image, @x, @y, @spriteX, @spriteY);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment