Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native plugin to support variable units #578

Open
3 tasks done
jonathandewitt-dev opened this issue Aug 21, 2022 · 3 comments
Open
3 tasks done

native plugin to support variable units #578

jonathandewitt-dev opened this issue Aug 21, 2022 · 3 comments

Comments

@jonathandewitt-dev
Copy link

What would you want to propose?

I would love added support for the upcoming variable units syntax.

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

Suggested solution

In postcss-custom-properties, I imagine this would be a trivial addition to the transformations, given that the discussion around it suggests that 20--hem is nothing but syntax sugar for calc(20 * var(--hem))

Additional context

No response

Validations

  • Follow our Code of Conduct
  • 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
@jonathandewitt-dev jonathandewitt-dev added the feature request New feature or request label Aug 21, 2022
@romainmenke
Copy link
Member

@jonathantneal created a PostCSS plugin for this : https://github.com/csstools/custom-units

But for postcss-preset-env it is to early to include this.
At the moment there is only an issue on csswg-drafts : w3c/csswg-drafts#7379

@jonathandewitt-dev
Copy link
Author

Oh, awesome, I was looking all over for a PostCSS plugin, but all the ones I found via Google were non-native custom syntax. Thanks for the link!

@romainmenke
Copy link
Member

specification : https://drafts.csswg.org/css-variables-2/#variable-units

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants