csstools / csstools/postcss-plugins

CSS Values lvl 5, standard if() syntax

Offen
#1,667 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
feature request
Vorherrschende Sprache
CSS
Sterne
1.1k
Forks
83
Ø Merge
10 Std. 16 Min.
Gemergte PRs (30 T.)
16

Beschreibung

### What would you want to propose?

Spec: https://drafts.csswg.org/css-values-5/#if-notation
This is the draft for a standard conditional selector.
There is a plugin that does similar thing called postcss-conditional-values, it could either be modified to support new experimental syntax, or a new plugin could be made partly based on it.
Would be nice to have a polyfill for this in the future with the standard syntax.

### Suggested solution

Spec allows media queries, and overall it is differs from postcss-conditional-values in a number of ways, so a new plugin is probably better.

Spec allows stuff like this:
```css
.valid-if {
--if-clause: media(width >= 600px): blue;
color: if(...var(--if-clause); else: green;);
}
```
I don't think is something that can be polyfilled

### Additional context

Overall this is more of a different syntax for queries, and doesn't replace postcss-conditional-values.

This request is related to https://github.com/csstools/postcss-plugins/issues/134 for some part.

### Validations

- [x] Follow our [Code of Conduct](https://github.com/csstools/postcss-plugins/blob/master/CODE_OF_CONDUCT.md)
- [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

### Would you like to open a PR for this feature?

- [ ] I'm willing to open a PR

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start by reading the CSS Values Level 5 if() notation specification and comparing it with the existing postcss-conditional-values plugin. The issue does not name files, tests, or a defined implementation scope; done would require agreeing whether a new plugin can support a useful subset of the standard syntax and how that scope should be validated.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
css
Bereich
frontend, web-dev
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.