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

Default values for custom variables #1543

Closed
blasten opened this issue May 15, 2015 · 3 comments · Fixed by #1602
Closed

Default values for custom variables #1543

blasten opened this issue May 15, 2015 · 3 comments · Fixed by #1602
Assignees
Labels

Comments

@blasten
Copy link
Contributor

blasten commented May 15, 2015

If you have a default value for a custom variable that contains parenthesis, the regexp for detecting variables stops working.
Here's a use case:

 background-color: var(---default-color, rgba(0, 0, 0, 0.5));

The regexp thinks that the closing parenthesis is the first ) I wonder if there's a solution using regexp for dealing with recursion.
The workaround is to have a

:root { 
   ---default-color:  rgba(0, 0, 0, 0.5);
}
@blasten blasten added the bug label May 15, 2015
@kevinpschaaf
Copy link
Member

Another short-term option would be this:

:host {
  --default-default-color: rgba(0, 0, 0, 0.5);
}

... {
  background-color: var(--default-color, --default-default-color);
}

We will work on this; it's a limitation to the current parsing techniques being used.

@sorvell
Copy link
Contributor

sorvell commented May 21, 2015

Other possibilities that are short of more complex parsing: (1) support 1 level of inner-parens, (2) require escaping of inner parens.

@blasten
Copy link
Contributor Author

blasten commented May 22, 2015

👍 glad to hear

@sorvell sorvell added p2 and removed p3 labels May 23, 2015
sorvell pushed a commit that referenced this issue May 23, 2015
@sorvell sorvell mentioned this issue May 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants