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

Can't use variables for custom property names in @each loops #75

Open
spaceninja opened this issue Apr 17, 2019 · 1 comment
Open

Can't use variables for custom property names in @each loops #75

spaceninja opened this issue Apr 17, 2019 · 1 comment

Comments

@spaceninja
Copy link

I'm trying to set up an each loop to render a list of layers as custom properties that we'll use for z-index values in our pattern library. However, I can't find a way to get the layer variable to render as a custom property name.

Here's a test case:

$layers: alpha, beta, gamma, delta;

:root {
  @each $layer $i in $layers {
    --#{$layer}: $i;
  }
}

.beta {
  z-index: var(--beta);
}
@yangshun
Copy link

yangshun commented Apr 17, 2019

You might want to check out https://github.com/outpunk/postcss-each which works for me (although the syntax is a little different).

So far my experience with this plugin has been quite buggy. The examples in the README don't work.

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

No branches or pull requests

2 participants