Last active
August 29, 2015 14:21
-
-
Save jaicab/16f04ff12d551b551902 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
This file contains 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
// ---- | |
// libsass (v3.2.4) | |
// ---- | |
$bodyclass: '.bodyclass'; | |
@mixin classmerge{ | |
$selector-list: &; | |
@each $selector in $selector-list { | |
$others: (); | |
// Just html class - .htmlclass | |
$htmlclass: nth($selector, 1); | |
// If more than one element | |
@if(length($selector)>1){ | |
@for $i from 2 through length($selector) { | |
// Add the other selectors | |
$others: append($others, nth($selector, $i), space); | |
} | |
} | |
@at-root{ | |
/*! This should produce: | |
.js .bodyclass .element .active */ | |
#{$htmlclass} { | |
#{unquote($bodyclass)} { | |
#{$others} { | |
@content; | |
} | |
} | |
} | |
} | |
@at-root{ | |
/*! (HACK) This fixes it though, but just for this case */ | |
html{ | |
&#{$htmlclass} { | |
#{unquote($bodyclass)} { | |
#{$others} { | |
@content; | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
.js{ | |
.element{ | |
.active{ | |
color: blue; | |
@include classmerge { | |
background: red; | |
} | |
} | |
} | |
} |
This file contains 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
.js .element .active { | |
color: blue; | |
} | |
/*! This should produce: | |
.js .bodyclass .element .active */ | |
.js .element .active .js .bodyclass .element .active { | |
background: red; | |
} | |
/*! (HACK) This fixes it though, but just for this case */ | |
html.js .bodyclass .element .active { | |
background: red; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment