Skip to content

Instantly share code, notes, and snippets.

@adamkiss
Created May 2, 2017 11:25
Show Gist options
  • Save adamkiss/60b2c81e61d943af7fd5db2f3aa8d700 to your computer and use it in GitHub Desktop.
Save adamkiss/60b2c81e61d943af7fd5db2f3aa8d700 to your computer and use it in GitHub Desktop.
Testing ruleset generation Sass
$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