-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Migrate @media screen(…)
#14603
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
Migrate @media screen(…)
#14603
Conversation
thecrypticace
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💪
adamwathan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I think this should use the theme function instead of inlining the raw value though.
81b4998 to
28b2c1a
Compare
|
Made some updates:
Also tried with an alternative using |
232e078 to
8d1576d
Compare
In other cases, or using legacy JS object syntax, we can't use the `theme(…)` function, therefore we fully expand the media query in your CSS.
This reverts commit a1113f8. This is way too experimental and no browser implements this feature yet. See: https://caniuse.com/?search=custom-media We can use lightningcss that transpiles is properly, but in environments such as the CDN we don't have access to lightningcss.
8d1576d to
dc85269
Compare
Made sure that we use theme(…) in the simple cases and expand to the full @media if we can't use theme(…)
This PR adds a codemod that migrates the
@media screen(…)to the properly expanded@media (…)syntax.Will be converted to:
If you happen to have custom screens (even complex ones), the screen will be converted to a custom media query.
With a custom
tailwind.config.jsfile with a config like this:Then the codemod will convert it to: