Skip to content

V6 RoadmapΒ #42

@yisibl

Description

@yisibl

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

Spec issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions