Skip to content

Instantly share code, notes, and snippets.

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