Closed hnrchrdl closed 4 years ago
Should work, there is even an issue about the cases when it should not - https://github.com/theKashey/used-styles/issues/10
However add I've added a few test to double check, and they are all green.
thanks a lot for looking into this. tests look good.
the problem is with filtering used selectors, at least when using criticalStylesToString
.
for example considering the following css
h1 {
margin-top: 50px;
}
h1 {
@include breakpoint(small only) {
margin-top: 30px;
}
}
it would only interleave the first rule. the second one with the media query is filtered because the selector was already used.
Not sure that's a valid CSS. It's more looks like SASS
In short
filter
functionShould be fine from now on.
are media queries supposed to be supported by this library? I guess not properly, I do not seem to get any critical css for selectors that are behind media queries.