Skip to content

Instantly share code, notes, and snippets.

@vitto
Last active August 29, 2015 14:03
Show Gist options
  • Save vitto/107eb80a2b8d5c1c04f3 to your computer and use it in GitHub Desktop.
Save vitto/107eb80a2b8d5c1c04f3 to your computer and use it in GitHub Desktop.
Frontsize - Set sprite position example
<div class="block">Pencil</div>
<div class="my-sprite pencil"></div>
<div class="block top-margin">Ruler</div>
<div class="my-sprite ruler"></div>
<div class="block top-margin">Eraser</div>
<div class="my-sprite eraser"></div>
<div class="block top-margin">Bin</div>
<div class="my-sprite bin"></div>
.my-sprite {
@width : 32px;
@height : @width;
@imageWidth : 64px;
@imageHeight : @imageWidth;
.spriteRetina("standard-sprite.png", "retina-sprite.png", @width, @height, @imageWidth, @imageHeight);
&.pencil {
.spritePosition(0, 0, @width, @height);
}
&.ruler {
.spritePosition(1, 0, @width, @height);
}
&.eraser {
.spritePosition(0, 1, @width, @height);
}
&.bin {
.spritePosition(1, 1, @width, @height);
}
}
@vitto
Copy link
Author

vitto commented Jul 18, 2014

spriteRetina

Param Default value Required Comment
@defaultImage none yes
@retinaImage none yes
@width none yes
@height @width yes
@imageWidth none yes
@imageHeight none yes
@rootPath @root-path no Frontsize var from app.less

spritePosition

Param Default value Required Comment
@horizontalPosition 0 no
@verticalPosition 0 no
@width 0 no
@height @width no

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment