Skip to content

Instantly share code, notes, and snippets.

@butchi
Created June 14, 2014 09:56
Show Gist options
  • Save butchi/facf83184e4d70d82200 to your computer and use it in GitHub Desktop.
Save butchi/facf83184e4d70d82200 to your computer and use it in GitHub Desktop.
Sassのif文で変数の代入 ref: http://qiita.com/butchi_y/items/bc7aae615e7bc3ac7900
@each $type in "facebook" "twitter" {
.#{$type} {
@if $type == "facebook" {
$button: "button_like.png";
} @else if $type == "twitter" {
$button: "button_tweet.png";
}
width: image-width($button);
height: image-height($button);
background-image: image-url($button);
background-repeat: no-repeat;
}
}
@each $type in "facebook" "twitter" {
.#{$type} {
$button: "";
@if $type == "facebook" {
$button: "button_like.png";
} @else if $type == "twitter" {
$button: "button_tweet.png";
}
width: image-width($button);
height: image-height($button);
background-image: image-url($button);
background-repeat: no-repeat;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment