Last active
June 20, 2019 11:35
-
-
Save iconifyit/e58e06a8d6a2564648eaff8a7ceb1b3a to your computer and use it in GitHub Desktop.
SASS : Dynamically Build Ruleset
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
@mixin layout($sections, $unit:"%") { | |
#content { | |
@each $name, $rules in $sections { | |
.#{$name} { | |
@each $key, $value in $rules { | |
#{$key} : $value | |
} | |
} | |
} | |
} | |
} | |
$sections: ( | |
header: (width: 100%, background: #aaa), | |
sidebar: (width: 33%, background: #ccc), | |
body: (width: 67%, background: #ddd), | |
footer: (width: 100%, background: #bbb) | |
); | |
@include layout($sections) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment