-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add support for nested CSS variables #90
base: master
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: b915fe7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
}; | ||
|
||
public resolveRecursiveVariables = (value: string) => { | ||
for (let i = 0; i < 20; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the for loop run 20? Is it because the maximum recursion depth is thought to be 20?
const variableReference = value.match(/^var\(\s*([a-zA-Z0-9-]+)\s*\)$/)?.[1]; | ||
if (variableReference) { | ||
const newValue = this.cacheManager.get(variableReference)?.symbol?.value; | ||
if (newValue) { | ||
value = newValue; | ||
} else { | ||
break; | ||
} | ||
} else { | ||
break; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const variableReference = value.match(/^var\(\s*([a-zA-Z0-9-]+)\s*\)$/)?.[1]; | |
if (variableReference) { | |
const newValue = this.cacheManager.get(variableReference)?.symbol?.value; | |
if (newValue) { | |
value = newValue; | |
} else { | |
break; | |
} | |
} else { | |
break; | |
} | |
const variableReference = value.match(/^var\(\s*([a-zA-Z0-9-]+)\s*\)$/)?.[1]; | |
if (!variableReference) { | |
break; | |
} | |
const newValue = this.cacheManager.get(variableReference)?.symbol?.value; | |
if (newValue) { | |
value = newValue; | |
continue; | |
} | |
break; |
I think nested if statements are complicated. How about this?
@@ -14,7 +14,7 @@ | |||
}, | |||
"dependencies": { | |||
"axios": "^0.27.2", | |||
"culori": "0.20.1", | |||
"culori": "^4.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to be updated...! #95
This adds support for nested CSS variables. See screenshot for example:
Resolves #14