Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

media query support #21

Closed
hnrchrdl opened this issue Jun 5, 2020 · 5 comments · Fixed by #22
Closed

media query support #21

hnrchrdl opened this issue Jun 5, 2020 · 5 comments · Fixed by #22

Comments

@hnrchrdl
Copy link
Contributor

hnrchrdl commented Jun 5, 2020

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.

theKashey added a commit that referenced this issue Jun 7, 2020
@theKashey
Copy link
Owner

Should work, there is even an issue about the cases when it should not - #10

However add I've added a few test to double check, and they are all green.

@hnrchrdl
Copy link
Contributor Author

hnrchrdl commented Jun 7, 2020

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.

@theKashey
Copy link
Owner

Not sure that's a valid CSS. It's more looks like SASS

@theKashey
Copy link
Owner

In short

theKashey added a commit that referenced this issue Jun 8, 2020
theKashey added a commit that referenced this issue Jun 8, 2020
@theKashey
Copy link
Owner

Should be fine from now on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants