Last active
September 15, 2016 10:32
-
-
Save jrencz/66aff7d3c0395baac3e591d4ebdd0f60 to your computer and use it in GitHub Desktop.
variable interpolations in Sass
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.21) | |
// Compass (v1.0.3) | |
// ---- | |
$color-rebeccapurple: rebeccapurple; | |
$color-red: red; | |
$color-blue: blue; | |
@mixin color( | |
$color: $color-red, | |
$color-hover: $color | |
) { | |
color: $color; | |
&:hover { | |
color: $color-hover; | |
} | |
} | |
b { | |
} | |
a { | |
@include color; | |
&.blue { | |
@include color($color: $color-blue); | |
} | |
&.different-hover { | |
@include color($color: $color-blue, $color-hover: $color-rebeccapurple); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a { | |
color: red; | |
} | |
a:hover { | |
color: red; | |
} | |
a.blue { | |
color: blue; | |
} | |
a.blue:hover { | |
color: blue; | |
} | |
a.different-hover { | |
color: blue; | |
} | |
a.different-hover:hover { | |
color: rebeccapurple; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.21) | |
// Compass (v1.0.3) | |
// ---- | |
$color-rebeccapurple: rebeccapurple; | |
$color-red: red; | |
$color-blue: blue; | |
@mixin color( | |
$color: $color-red, | |
$color-hover: $color | |
) { | |
color: $color; | |
&:hover { | |
color: $color-hover; | |
} | |
} | |
b { | |
} | |
a { | |
@include color; | |
&.blue { | |
@include color($color: $color-blue); | |
} | |
&.different-hover { | |
@include color($color: $color-blue, $color-hover: $color-rebeccapurple); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a { | |
color: red; | |
} | |
a:hover { | |
color: red; | |
} | |
a.blue { | |
color: blue; | |
} | |
a.blue:hover { | |
color: blue; | |
} | |
a.different-hover { | |
color: blue; | |
} | |
a.different-hover:hover { | |
color: rebeccapurple; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment