Closed titouanmathis closed 5 years ago
I thinks is a better pratice. We rewrite the previous function who use it ?
👍 dry approach This will be clearer to read, and easier to update in the future.
Shall we also add a way to pass a force
option ?
It will be usefull, but it need to be more extendable:
@include breakpoints-modifier(('xs, 's', 'xl))
)$key
parameter thanks to @receive
directive.dart-sass
to compile our SCSS files in order to be able to use content arguments, the syntax is the following:@mixin for-each-breakpoints() {
@each $breakpoint in $breakpoints {
$key: nth($breakpoint, 1);
@media #{md($key)} {
@content ($key);
}
}
}
.foo {
display: block;
}
@include for-each-breakpoints using ($key) {
.foo--#{$key} {
display: block;
}
}
Like @lusimeon idea to have a list of breakpoints to include, to reduce the number of generated classes.
In order to make this work we need a dedicated $var
for each loop ? Or I am missing something ?
See #21 for a more detailed proposal.
Closed by #21 🙂
In order to ease the use of our configuration maps, I think we could create a function/mixin to automatically generate CSS based on their values.
For example, we often use the values of
breakpoints
as modifiers with the following@each
loop:What if we could abstract this
@each
mechanic into a mixin or a function? I have a working, but limited, example for a mixin:I would be glad to have some feedback on this, @studiometa/studiometa-scss-toolkit 🙂