Skip to content

Instantly share code, notes, and snippets.

@trub
Created April 8, 2014 22:03
Show Gist options
  • Select an option

  • Save trub/10200004 to your computer and use it in GitHub Desktop.

Select an option

Save trub/10200004 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// libsass (v0.7.0)
// ----
// common @each loop
/*-----------------------------------------*/
$icons: as bs cs;
@each $icon in $icons {
.icon-#{$icon} {
background-image: url(/images/icons/#{icon}.png);
}
}
// method use multiplte objects in array
/*-----------------------------------------*/
$icon-chars: (twitter 'e0001' blue) (facebook 'e0002' green);
@each $icon in $icon-chars {
.#{nth($icon, 1)}-icon {
color: nth($icon, 3);
&:after {
content: '#{nth($icon, 2)}';
}
}
}
/*-----------------------------------------*/
.icon-as {
background-image: url(/images/icons/icon.png); }
.icon-bs {
background-image: url(/images/icons/icon.png); }
.icon-cs {
background-image: url(/images/icons/icon.png); }
/*-----------------------------------------*/
.twitter-icon {
color: blue; }
.twitter-icon:after {
content: 'e0001'; }
.facebook-icon {
color: green; }
.facebook-icon:after {
content: 'e0002'; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment