Last active
October 12, 2020 10:34
-
-
Save mmintel/045ffce76b00b327bfc0 to your computer and use it in GitHub Desktop.
Revisions
-
mmintel revised this gist
Aug 24, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -30,8 +30,8 @@ $modifierSeparator: '--'; @mixin e($element) { $selector: &; @if containsModifier($selector) { $block: getBlock($selector); @at-root { #{$selector} { #{$block+$elementSeparator+$element} { -
mmintel revised this gist
Aug 20, 2014 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -30,10 +30,11 @@ $modifierSeparator: '--'; @mixin e($element) { $selector: &; $block: getBlock($selector); @if containsModifier($selector) { @at-root { #{$selector} { #{$block+$elementSeparator+$element} { @content; } } -
mmintel revised this gist
Aug 20, 2014 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,6 @@ $modifierSeparator: '--'; @mixin e($element) { $selector: &; @if containsModifier($selector) { @at-root { #{$selector} { -
mmintel renamed this gist
Aug 20, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
mmintel created this gist
Aug 20, 2014 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,75 @@ $elementSeparator: '__'; $modifierSeparator: '--'; @function containsModifier($selector) { $selector: selectorToString($selector); @if str-index($selector, $modifierSeparator) { @return true; } @else { @return false; } } @function selectorToString($selector) { $selector: inspect($selector); //cast to string $selector: str-slice($selector, 2, -2); //remove brackets @return $selector; } @function getBlock($selector) { $selector: selectorToString($selector); $modifierStart: str-index($selector, $modifierSeparator) - 1; @return str-slice($selector, 0, $modifierStart); } @mixin b($block) { .#{$block} { @content; } } @mixin e($element) { $selector: &; @debug $selector; @if containsModifier($selector) { @at-root { #{$selector} { #{getBlock($selector)+$elementSeparator+$element} { @content; } } } } @else { @at-root { #{$selector+$elementSeparator+$element} { @content; } } } } @mixin m($modifier) { @at-root { #{&}#{$modifierSeparator+$modifier} { @content; } } } @include b(test) { background: red; @include e(element){ font-size: 14px; @include m(big) { font-size: 18px; } }; @include m(modifier) { color: blue; @include e(subelement) { background: gray; } } }