Last active
August 29, 2015 14:08
-
-
Save KittyGiraudel/707fe9fada1ea8814e94 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.7) | |
| // Compass (v1.0.1) | |
| // ---- | |
| /// Hacking specificity made easy | |
| /// If you have to use this, you are either using a shitty framework | |
| /// or doing something wrong. In any case, good luck. | |
| /// | |
| /// @param {String} $class - Class to multiply | |
| /// @param {Number} $level (1) - Number of times to multiply `$class` | |
| @mixin specificity-hack($class, $level: 1) { | |
| $selector: $class; | |
| @for $i from 1 through $level { | |
| $selector: selector-append($selector, $class); | |
| } | |
| #{$selector} { @content; } | |
| } | |
| specificity[is="hard"].you-know { | |
| content: "Well, kinda..."; | |
| } | |
| @include specificity-hack('.hack') { | |
| color: "Look ma, 2 classes!"; | |
| } | |
| @include specificity-hack('.hack', 41) { | |
| content: "Grab your towel and don't panic"; | |
| } | |
| @include specificity-hack('.Na', 16) { | |
| BATMAN { | |
| content: "I'm Batman."; | |
| } | |
| } |
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
| specificity[is="hard"].you-know { | |
| content: "Well, kinda..."; | |
| } | |
| .hack.hack { | |
| color: "Look ma, 2 classes!"; | |
| } | |
| .hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack.hack { | |
| content: "Grab your towel and don't panic"; | |
| } | |
| .Na.Na.Na.Na.Na.Na.Na.Na.Na.Na.Na.Na.Na.Na.Na.Na.Na BATMAN { | |
| content: "I'm Batman."; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment