-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
As more and more browsers support range syntax, the syntax of @media
becomes complex and the current regular expression substitution pattern will become difficult to maintain.
For example, the following rules are valid in browsers.
@media (900px = width) {}
@media (900px < width) {}
@media (900px <= width) {}
@media (900px <= width <= 1200px) {}
@media ( width > calc(5px + 1rem) ) {}
@media ( width < calc(Infinity * 1px) ) {}
@media ( width > max(30px, 30em) ) {}
@media not (900px > width) {}
@media (width >= 900px) and (not (width = 910px)) {}
@media (width >= 500px) and ((499px > width) or (not (width = 500px))) {}
There are also new @container
rules:
@container layout-name (width >= 500px) {}
So, consider a complete refactoring in the new version, adding a dedicated at rule parser to parse them. Perhaps a good place to start is to investigate css-tree in conjunction with PostCSS.
The postcss-media-minmax
plugin is very popular, with over 6 million downloads per week. The refactoring will maintain better compatibility with browsers, which will be significant.
Feel free to discuss, PR or sponsor!
Related packages
- https://github.com/olsonpm/postcss-create-mq-ast
- https://github.com/dryoma/postcss-media-query-parser
- https://github.com/TrySound/postcss-value-parser
Spec issue
Semigradsky, romainmenke, Antonio-Laguna and artemjacksonartemjackson
Metadata
Metadata
Assignees
Labels
No labels