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

Use range context in media queries? #1

Closed
romainmenke opened this issue Jan 17, 2023 · 3 comments
Closed

Use range context in media queries? #1

romainmenke opened this issue Jan 17, 2023 · 3 comments

Comments

@romainmenke
Copy link

romainmenke commented Jan 17, 2023

https://github.com/allmyfutures/postcss-custom-media-generator/blob/3fe69171b3bdb06255d0fc9ff45d389fa9c2f474/src/generate_media_queries.ts#L16

This can also be written as :

 result[`--${key}-only`] = `(${breakpoint}px <= width < ${nextBreakpoint}px)`;

This can avoid issues were browsers produce viewports with fractional pixels.

@jasonraimondi
Copy link
Owner

Thanks for the great tip!

I didnt think of this because originally, I didn't have this written as an actual plugin, just a small helper. I was using the importFrom options in the postcss-custom-media package, so when that option was removed, I realized I would need to rewrite my helper into an actual plugin.

My one thought on this is that it would then require two plugins to run now, postcss-custom-media and postcss-media-minmax (or of course, just postcss-preset-env), but I do not think that is a problem.

Definitely am going to consider making these tweaks. Thank you for your input!

@romainmenke
Copy link
Author

Thank you for making this plugin!
I am sure others in the community will find it helpful :)

@romainmenke
Copy link
Author

Awesome! 🙇

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