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

Down-Transpile Media Query Range Syntax to min- and max-? #294

Open
karlhorky opened this issue Jun 24, 2022 · 1 comment
Open

Down-Transpile Media Query Range Syntax to min- and max-? #294

karlhorky opened this issue Jun 24, 2022 · 1 comment

Comments

@karlhorky
Copy link

Hi there, first of all, thanks for the continued work on Stylis! Very essential to the CSS-in-JS ecosystem.

Just learned about the Media Query Range Syntax, looks great:

/* This...
@media (min-width: 400px) {}
/* ...can now be replaced by this: */
@media (width >= 400px) {}

Since Chrome 104 and Firefox 63 have support for this, it would be nice to be able to use the new syntax out of the box with no plugins (eg. in Emotion) while still supporting older browsers.

Currently, Stylis leaves these media queries untouched, which means they will only work in these (limited) supporting browsers.

Maybe Stylis could parse these new type of media queries and emit the old min- and max- syntax?

Alternatives Considered

Leave it to the community to create a Stylis plugin for this (is there a centralized place where Stylis plugins can be found / requested? there wasn't much coming up in my searches...)

Prior art

The PostCSS ecosystem has a plugin for this over here: https://github.com/postcss/postcss-media-minmax

cc @Andarist

@Andarist
Copy link
Collaborator

Leave it to the community to create a Stylis plugin for this (is there a centralized place where Stylis plugins can be found / requested?

I don't think so. Writing plugins is also quite involved - although a simple plugin to replace one pattern like this with another wouldn't have to be that bad.

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

No branches or pull requests

2 participants