mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Add extract-match mixin
Works similar to apply-match but exports the @__match variable to the parent scope instead of accepting a ruleset. I have a suspicion that this will generally be easier to wield and produce more predictable results than all the crazy extra scoping bullshit I always have to try and do when using the "closure"-ish approach I use with apply-match.
This commit is contained in:
parent
d7a0db958f
commit
dc73e0a578
@ -14,3 +14,17 @@
|
||||
@ruleset();
|
||||
}
|
||||
}
|
||||
|
||||
.extract-match(@map; @search) {
|
||||
@current: extract(extract(@map, 1), 1);
|
||||
.extract-match(@map; @search; @current; 1);
|
||||
}
|
||||
|
||||
.extract-match(@map; @search; @current; @i) when not (@search = @current) and (@i <= length(@map)) {
|
||||
@current: extract(extract(@map, @i + 1), 1);
|
||||
.extract-match(@map; @search; @current; @i + 1);
|
||||
}
|
||||
|
||||
.extract-match(@map; @search; @current; @i) when (@search = @current) and (@i <= length(@map)) {
|
||||
@__match: extract(extract(@map, @i), 2);
|
||||
}
|
||||
|
||||
@ -16,11 +16,10 @@
|
||||
}
|
||||
|
||||
.screen(@screen, @ruleset) {
|
||||
.apply-match(@screens; @screen; {
|
||||
@media (min-width: @__match) {
|
||||
@ruleset();
|
||||
}
|
||||
});
|
||||
.extract-match(@screens; @screen);
|
||||
@media (min-width: @__match) {
|
||||
@ruleset();
|
||||
}
|
||||
}
|
||||
|
||||
.no-focus {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user