-
Notifications
You must be signed in to change notification settings - Fork 244
Closed
Description
I am working on the PostCSS plugin for @custom-media and found it to be wildly incorrect.
When comparing with lightningcss I think I also found some instances where lightningcss has bugs.
@custom-media --not-width not (min-width: 300px);
@media screen and ((prefers-color-scheme: dark) or (--not-width)) {
.foo {
order: 6;
}
}becomes
@media screen and ((prefers-color-scheme: dark) or not (min-width: 300px)) {
.foo {
order: 6;
}
}This is not a valid media query.
Equivalent could be :
@media screen {
@media (prefers-color-scheme: dark) {
.foo {
order: 6;
}
}
@media not (min-width: 300px) {
.foo {
order: 6;
}
}
}For the PostCSS plugin I am now considering only allowing <media-feature> https://drafts.csswg.org/mediaqueries-5/#mq-syntax
/* supported */
@custom-media --mq (min-width: 300px);/* not supported */
@custom-media --mq-with-type screen and (min-width: 300px);
@custom-media --mq-with-modifier not (min-width: 300px);
@custom-media --mq-list (min-width: 300px), (prefers-color-scheme: dark);I think technically lists would be possible but at this time I prefer to scale back the scope of the plugin as much as possible to something that is known to be correct.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels