Skip to content

Instantly share code, notes, and snippets.

@micahgodbolt
Created July 15, 2014 18:04
Show Gist options
  • Save micahgodbolt/bbff456e01dbe86ae6d2 to your computer and use it in GitHub Desktop.
Save micahgodbolt/bbff456e01dbe86ae6d2 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.0.rc.1)
// Compass (v1.0.0.alpha.20)
// ----
@mixin insert-context($target, $context, $order: before) {
$new-context: "";
@if $order == before {
$new-context: selector-nest($context, $target);
}
@else {
$new-context: selector-nest($target, $context);
}
$new-selector: selector-replace(&, $target, $new-context);
@at-root #{$new-selector} {
@content;
}
}
.tabs {
.tab {
background: red;
&:hover {
background: white;
}
}
.tab-link {
color: white;
@include insert-context('.tab-link', '.tab:hover', after) {
color: red;
}
}
}
.tabs .tab {
background: red;
}
.tabs .tab:hover {
background: white;
}
.tabs .tab-link {
color: white;
}
.tabs .tab-link .tab:hover, .tab-link .tabs .tab:hover {
color: red;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment