csstools / csstools/postcss-plugins

native plugin to support variable units

Aperta
#578 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
feature request requires browser vendor interest
Lingua principale
CSS
Stelle
1.1k
Fork
83
Merge medio
10h 16m
PR unite (30g)
16

Descrizione

### What would you want to propose?

I would love added support for the upcoming [variable units](https://drafts.csswg.org/css-variables-2/#variable-units) syntax.

```css
:host {
--hem: 1em;
}
.wrapper {
width: 20--hem;
}
```

### Suggested solution

In postcss-custom-properties, I imagine this would be a trivial addition to the [transformations](https://github.com/csstools/postcss-plugins/blob/main/plugins/postcss-custom-properties/src/lib/transform-properties.ts), given that the [discussion around it](https://github.com/w3c/csswg-drafts/issues/7379) suggests that `20--hem` is nothing but syntax sugar for `calc(20 * var(--hem))`

### Additional context

_No response_

### 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?

- [X] I'm willing to open a PR

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia da plugins/postcss-custom-properties/src/lib/transform-properties.ts e leggi la proposta variable-units di CSS Variables Level 2 e la discussione CSSWG collegata. Controlla i test di trasformazione esistenti del plugin, quindi verifica che la sintassi 20--hem venga gestita come proposto, senza modificare il comportamento non correlato di custom properties.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
css
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.