Last active
August 29, 2015 14:02
-
-
Save donatj/d4d69335a4fc3801b957 to your computer and use it in GitHub Desktop.
SCSS Scaled Sprite Map
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin scaled-sprite-background($name, $scale, $spritemap) { | |
background: $spritemap; | |
$spritePath: sprite-path($spritemap); | |
@include background-size(image-width($spritePath) * $scale); | |
$position: sprite-position($spritemap, $name); | |
background-position: (nth($position, 1) * $scale) (nth($position, 2) * $scale); | |
height: image-height(sprite-file($spritemap, $name)) * $scale; | |
width: image-width(sprite-file($spritemap, $name)) * $scale; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import "ScaledSpriteMap"; | |
@import "compass/utilities/sprites"; | |
$sprites: sprite-map("sprites/*.png"); | |
.example { | |
@include scaled-sprite-background(spritename, .5, $sprites); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment