diff --git a/src/generators/_matching.less b/src/generators/_matching.less index 9de841308..cea975260 100644 --- a/src/generators/_matching.less +++ b/src/generators/_matching.less @@ -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); +} diff --git a/src/utilities/misc.less b/src/utilities/misc.less index 55a06a7f9..861b4e3a8 100644 --- a/src/utilities/misc.less +++ b/src/utilities/misc.less @@ -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 {