Skip to content

Commit

Permalink
Merge pull request #105 from willofindie/feat/issue-104
Browse files Browse the repository at this point in the history
feat: immediately return value of already parsed color.
  • Loading branch information
phoenisx authored Mar 6, 2023
2 parents c050f0e + 73fafe3 commit 7e0b5c8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ export async function normalizeVars(
const propertyName = value.match(CSS_VAR_FUNCTION_NOTATION)?.groups?.args;
if (propertyName) {
const cssVar = cssVars.find(cssVar => cssVar.property === propertyName);
if (cssVar?.color) {
return {
isColor: true,
value: cssVar?.color,
};
}
return await normalizeVars(cssVar?.value || "");
}
} else if (cssVars && SCSS_COLOR_INTERPOLATION.test(value)) {
Expand Down

0 comments on commit 7e0b5c8

Please sign in to comment.