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

CSS variables not resolved correctly by functions when passed as a parameter #2246

Closed
lozandier opened this issue Feb 19, 2017 · 2 comments
Closed

Comments

@lozandier
Copy link

lozandier commented Feb 19, 2017

Problem

For whatever reason, Sass con't enable the use of CSS variables within functions as expected; this is particularly problematic with color functions.

Sass Code (Used Sass 4.0 & LibSass 3.5)

html {
--google-red-100: #f4c7c3;
--dark-primary-opacity: 0.87;
}

.mytext {
  color: rgba(var(--google-red-100), var(--dark-primary-opacity));
}

Expected Result

html {
  --google-red-100: #f4c7c3;
  --dark-primary-opacity: 0.87;
}

.mytext {
  color: rgba(244, 199, 195, 0.87);
}

Actual Result

$color: "var(--google-red-100)" is not a color for `rgba'

It seems the parser doesn't resolve CSS variables when they are parameters of Sass functions

Recommended Reviewers

  • @nex3 & @chriseppstein being very familiar with how Sass has evolved to support CSS variables
@nex3
Copy link
Contributor

nex3 commented Feb 22, 2017

There's no way for Sass functions in general to handle CSS variables. CSS variables are resolved at runtime and are affected by the cascade and potentially by JavaScript, so their values aren't reliably available at compile-time when Sass runs. If you want to pass variables to Sass functions, they have to be Sass variables.

@nex3 nex3 closed this as completed Feb 22, 2017
@lozandier
Copy link
Author

lozandier commented Feb 22, 2017 via email

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