-
-
Save jdsteinbach/338e00af78e3ef7e0b5d to your computer and use it in GitHub Desktop.
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
$global_store: () | |
= override($args:(), $is_child:true) | |
@if $is_child | |
$global_store: () !global | |
$global_store: map-merge($global_store, $args) !global | |
= default($key_or_map, $value:null) | |
@if $value | |
+store-default($key_or_map, $value) | |
@else | |
@each $key, $value in $key_or_map | |
+store-default($key, $value) | |
= store-default($key, $value) | |
@if map-has-key($global_store, $key) | |
@else | |
$global_store: map-merge($global_store, ($key: $value)) !global | |
@function fetch($key) | |
@return map-get($global_store, $key) |
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
$global_store: (); | |
@mixin override($args, $is_child:true) { | |
@if $is_child { | |
$global_store: () !global; | |
} | |
$global_store: map-merge($global_store, $args) !global; | |
} | |
@mixin default($key_or_map, $value:null) { | |
@if $value { | |
@include store-default($key_or_map, $value); | |
} | |
@else { | |
@each $key, $value in $key_or_map { | |
@include store-default($key, $value); | |
} | |
} | |
} | |
@mixin store-default($key, $value) { | |
@if map-has-key($global_store, $key) { | |
} | |
@else { | |
$global_store: map-merge($global_store, ($key: $value)) !global; | |
} | |
} | |
@function fetch($key) { | |
@return map-get($global_store, $key); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment