Created
July 2, 2014 15:59
-
-
Save anatomic/02d65aebf5c502ac19b9 to your computer and use it in GitHub Desktop.
Working with !default and maps when creating a CSS framework
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
@import "main"; | |
$list-margin: $base-spacing-unit!default; | |
@mixin create-horizontal-list($name: 'ui-list') { | |
#{$name} { | |
list-style: none; | |
margin: 0; | |
&__item { | |
display: inline; | |
&:after { | |
content: ','; | |
} | |
} | |
} | |
} | |
@include export('ui-list') { | |
@include create-horizontal-list; | |
} |
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
$modules: ()!default; | |
$base-spacing-unit: 24px!default; | |
$base-ui-border-color: #dedede!default; | |
$base-ui-background-color: #f3f3f3!default; | |
@mixin export($name){ | |
@if index($modules, $name) == false { | |
$modules: append($modules, $name); | |
@content; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I did wonder about looking into whether you could use conditional control statements in a component to do the merging and it does work, but only if you want to change or add to the default map. It is impossible to take away.