Last active
January 31, 2016 17:53
-
-
Save camerond/026835a92e4c00da69e3 to your computer and use it in GitHub Desktop.
Classical mixin inheritance in Sass
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) |
@lifeiscontent Hmm. Belated thanks. Figures that it was too good to be true. Had fun experimenting, though.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@camerond your inheritance is a leaky abstraction: http://codepen.io/lifeiscontent/pen/emQeQM
look at the CSS output.