csstools / csstools/postcss-plugins

native plugin to support variable units

Open
#578 3 comments 0 reactions 0 assignees View on GitHub
feature request requires browser vendor interest
Dominant language
CSS
Stars
1.1k
Forks
83
Avg merge
10h 16m
Merged PRs (30d)
16

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.