Skip to content

Instantly share code, notes, and snippets.

@clayb
Forked from rattlion/main.scss
Created July 23, 2014 20:58
Show Gist options
  • Save clayb/b035da5e51360758d827 to your computer and use it in GitHub Desktop.
Save clayb/b035da5e51360758d827 to your computer and use it in GitHub Desktop.
Compass sprite for loop example
@import "compass";
@import "compass/reset";
@import "icon/*.png";
@include all-icon-sprites;
@import "logo/*.png";
@include all-logo-sprites;
@import "pencil/*.png";
@include all-pencil-sprites;
.icon-sprite,
.logo-sprite,
.pencil-sprite {
display: block;
text-indent: -99999em;
}
$icons: 'clock', 'people', 'truck';
@for $i from 1 through length($icons) {
.icon-#{nth($icons, $i)} {
$image: "#{nth($icons, $i)}";
height: icon-sprite-height($image);
width: icon-sprite-width($image);
}
}
$logos: 'large', 'small';
@for $i from 1 through length($logos) {
.logo-#{nth($logos, $i)} {
$image: "#{nth($logos, $i)}";
height: logo-sprite-height($image);
width: logo-sprite-width($image);
}
}
$pencils: 'large-button', 'button';
@for $i from 1 through length($pencils) {
.pencil-#{nth($pencils, $i)} {
$image: "#{nth($pencils, $i)}";
height: pencil-sprite-height($image);
width: pencil-sprite-width($image);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment