Skip to content

Instantly share code, notes, and snippets.

@souporserious
Created January 29, 2016 10:58
Show Gist options
  • Save souporserious/0d050e59df6e0731f862 to your computer and use it in GitHub Desktop.
Save souporserious/0d050e59df6e0731f862 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// libsass (v3.3.2)
// ----
@mixin link($initial-state, $hover: $initial-state, $active: $initial-state, $focus: $initial-state, $visited: $initial-state) {
$states: (
'hover': $hover,
'active': $active,
'focus': $focus,
'visited': $visited
);
$same-states: ();
@each $state, $color in $states {
@if ($initial-state != $color) {
&:#{$state} {
color: $color;
}
} @else {
$same-states: append($same-states, '&:#{$state}', 'comma');
}
}
&, #{$same-states} {
color: $initial-state;
}
}
a {
@include link(red, green, blue)
}
a:hover {
color: green;
}
a:active {
color: blue;
}
a, a:focus, a:visited {
color: red;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment