Created
January 24, 2021 10:38
-
-
Save jakob-e/f9db1b6df0add55f0937fc70139ab7e2 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
// ---------------------------------------- | |
$trace-list: (); | |
@mixin trace($name){ | |
$trace-list: append($trace-list, $name, comma) !global; | |
@content; | |
$trace-list: nth-remove($trace-list, -1) !global; | |
} | |
@function nth-remove($list, $n){ | |
$r: ();$n: if($n < 0, length($list) + $n + 1, $n); $b: is-bracketed($list); $s: list-separator($list); | |
@for $i from 1 through length($list){ @if $i != $n { $r: append($r, nth($list, $i)); }} | |
@return join((), $r, $s, $b); | |
} | |
// ---------------------------------------- | |
@mixin button { | |
@include trace(button){ | |
button { | |
mixin-context: $trace-list; | |
} | |
} | |
} | |
@mixin card { | |
@include trace(card){ | |
.card { | |
@include button; // (card, button,) | |
} | |
} | |
} | |
@mixin collection { | |
@include trace(collection){ | |
.collection { | |
@include card; // (collection, card, button,) | |
} | |
} | |
} | |
@mixin sign-up { | |
@include trace(up){ | |
.sign-up { | |
@include button; // (sign-up, button,) | |
} | |
} | |
} | |
@mixin log-in { | |
@include trace(in){ | |
.log-in { | |
@include button; // (log-in, button,) | |
} | |
} | |
} | |
@mixin modal { | |
@include trace(modal){ | |
.modal { | |
@include log-in; // (modal, log-in, button,) | |
} | |
} | |
} | |
@mixin sidebar { | |
@include trace(sidebar){ | |
.sidebar { | |
@include collection; // (sidebar, collection, card, button,) | |
@include button; // (sidebar, button,) | |
} | |
} | |
} | |
@include button; | |
@include log-in; | |
@include card; | |
@include collection; | |
@include sign-up; | |
@include sidebar; | |
@include modal; | |
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
<div>Lorem</div> |
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
button { | |
mixin-context: button; | |
} | |
.log-in button { | |
mixin-context: in, button; | |
} | |
.card button { | |
mixin-context: card, button; | |
} | |
.collection .card button { | |
mixin-context: collection, card, button; | |
} | |
.sign-up button { | |
mixin-context: up, button; | |
} | |
.sidebar .collection .card button { | |
mixin-context: sidebar, collection, card, button; | |
} | |
.sidebar button { | |
mixin-context: sidebar, button; | |
} | |
.modal .log-in button { | |
mixin-context: modal, in, button; | |
} |
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
{ | |
"sass": { | |
"compiler": "dart-sass/1.26.11", | |
"extensions": {}, | |
"syntax": "SCSS", | |
"outputStyle": "expanded" | |
}, | |
"autoprefixer": false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment