Skip to content

Instantly share code, notes, and snippets.

@dgalarza
Created February 2, 2012 15:56
Show Gist options
  • Save dgalarza/1724172 to your computer and use it in GitHub Desktop.
Save dgalarza/1724172 to your computer and use it in GitHub Desktop.
Compass Custom Sprites Definitions
@import 'compass/utilities/sprites/base';
$sprite-spacing: 1px;
$social_sprite: sprite-map('social-sprite/*.png', $spacing: $sprite-spacing);
@mixin sprite-dimensions($sprite, $image_name) {
height: image-height( sprite-file($sprite, $image_name) );
width: image-width( sprite-file($sprite, $image_name) );
}
@mixin quick-sprite($map, $image_name) {
background: sprite($map, $image_name);
@include sprite-dimensions($map, $image_name);
}
@mixin btn_sprite($btn) {
text-indent: -999em;
@include quick-sprite($social_sprite, 'btn-' + $btn);
&:hover { @include quick-sprite($social_sprite, 'btn-' + $btn + '-hover'); }
}
#blog a { @include btn_sprite('blog'); }
#facebook a { @include btn_sprite('facebook'); }
#twitter a { @include btn_sprite('twitter'); }
#github a { @include btn_sprite('github'); }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment