Created
May 2, 2017 11:25
-
-
Save adamkiss/60b2c81e61d943af7fd5db2f3aa8d700 to your computer and use it in GitHub Desktop.
Testing ruleset generation Sass
This file contains hidden or 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
$breakpoints-list: ( | |
ns: '>=44em' | |
); | |
$ruleset: ( | |
bg-r: ('background red'), | |
bg-g: ('background green', top 10px) | |
); | |
$breakpoints: ns; | |
@mixin generate_rules($ruleset, $breakpoints){ | |
@each $selector, $rules in $ruleset { | |
@debug($selector, $rules); | |
.#{$selector} { | |
@each $rule, $value in $rules { | |
@debug $rule, $value; | |
} | |
} | |
@each $bp in $breakpoints { | |
.#{$selector}-#{$bp} { | |
@include media(map-get($breakpoints-list, $bp)){ | |
@extend %#{$selector}; | |
} | |
} | |
} | |
} | |
} | |
@include generate_rules($ruleset, $breakpoints); | |
// @debug($ruleset); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment