Last active
August 29, 2015 14:17
-
-
Save KittyGiraudel/6c346a5c216058605ea3 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains hidden or 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.12) | |
// Compass (v1.0.3) | |
// ---- | |
/// Mixin to increase selector specificity | |
/// @author Hugo Giraudel | |
/// @param {Number} $level [2] - Specificity level | |
/// @example scss - Increase selector specificity | |
/// .foo { | |
/// @include specific { | |
/// color: red; | |
/// } | |
/// } | |
@mixin specific($level: 2) { | |
$selector: &; | |
@for $i from 1 to $level { | |
$selector: selector-append($selector, &); | |
} | |
@at-root #{$selector} { | |
@content | |
} | |
} | |
.foo { | |
@include specific { | |
color: red; | |
} | |
@include specific(10) { | |
.bar { | |
background: tomato; | |
} | |
} | |
} |
This file contains hidden or 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
.foo.foo { | |
color: red; | |
} | |
.foo.foo.foo.foo.foo.foo.foo.foo.foo.foo .bar { | |
background: tomato; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment