Skip to content

Instantly share code, notes, and snippets.

@bamboo-c
Created October 21, 2014 07:10
Show Gist options
  • Save bamboo-c/03b0e84e3b160850bbfc to your computer and use it in GitHub Desktop.
Save bamboo-c/03b0e84e3b160850bbfc to your computer and use it in GitHub Desktop.
Stylus + gulp.spritesmith で複数 dpi に対応した Mixin
// import spritesmith file
@import _parts
// mixin
sprite-bg( $i_sprites, $i_ratio = 2 )
$x = $i_sprites[2] / $i_ratio
$y = $i_sprites[3] / $i_ratio
$width = $i_sprites[4] / $i_ratio
$height = $i_sprites[5] / $i_ratio
$total_width = $i_sprites[6] / $i_ratio
$total_height = $i_sprites[7] / $i_ratio
width $width
height $height
background-image url( $i_sprites[8] )
background-repeat no-repeat
background-size $total_width $total_height
background-position $x $y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment