Skip to content

Instantly share code, notes, and snippets.

@teodragovic
Created January 16, 2016 10:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teodragovic/5e69b791f100d73a2304 to your computer and use it in GitHub Desktop.
Save teodragovic/5e69b791f100d73a2304 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// libsass (v3.3.2)
// ----
// http://csswizardry.com/2014/07/hacks-for-dealing-with-specificity/
@mixin stronger($selector, $factor: 1) {
$total: $selector;
@if $factor > 0 {
@for $i from 1 through $factor {
$total: $total + $selector;
}
#{$total} {
@content
}
} else {
@warn "Invalid factor value";
}
}
// DEMO
@include stronger('.class') {
test: test;
}
@include stronger('.class--one', 2) {
test: test;
}
@include stronger('.class--two', 5) {
test: test;
}
@include stronger('.class--three', -5) {
test: test;
}
.class.class {
test: test;
}
.class--one.class--one.class--one {
test: test;
}
.class--two.class--two.class--two.class--two.class--two.class--two {
test: test;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment