Skip to content

Commit

Permalink
fix: color return value error
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenisx committed Sep 11, 2021
1 parent 40f0836 commit e4d99e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ export const parseFiles = async function (
const isModified =
Object.keys(CACHE.fileMetas).length !== config.files.length;
const errorPaths: string[] = [];
const filesArray = <string[]>config.files;

for (const path of config.files) {
for (const path of filesArray) {
const cachedFileMeta = CACHE.fileMetas[path];
const meta = await statAsync(path);
const lastModified = meta.mtimeMs;
Expand Down
6 changes: 2 additions & 4 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function getValue(value: string, cssVars?: CSSVarDeclarations[]): string {
const cssVar = cssVars.find(
cssVar => cssVar.property === propertyName[1]
);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
return getValue(cssVar?.value || "", cssVars);
}
} else {
Expand Down Expand Up @@ -54,12 +55,9 @@ export function getColor(
/^#|^rgba?|^hsla?|^transparent$/.test(value) ||
CSS3Colors.includes(value.toLowerCase())
) {
const _color = value.replaceAll(/var\(.*?\)/, match =>
getValue(match, cssVars)
);
return {
success: true,
color: lighten(0, _color),
color: lighten(0, value),
};
}
}
Expand Down

0 comments on commit e4d99e8

Please sign in to comment.