Skip to content

Commit 1dad502

Browse files
committed
fix: tokencss path not recognized
1 parent 98b53a4 commit 1dad502

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"cssvar.postcssPlugins": [
33
// `cwd` option is required only if tokencss config is not declared directly under project root
4-
["@tokencss/postcss", { "cwd": "examples/tokencss-plugin/config" }]
4+
["@tokencss/postcss", { "cwd": "config" }]
55
]
66
}

examples/tokencss-plugin/index.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
body {
22
color: var(--color-red-2);
3+
background-color: var(--color-blue-4);
34
padding: var(--space-2xl);
45
}

src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,11 @@ export async function postcssPluginResolver(
401401
const { lookupPaths, cwd, ...rest } = options;
402402
switch (name) {
403403
case "@tokencss/postcss": {
404-
if (!cwd || !existsSync(resolve(cwd, "token.config.json"))) {
404+
const _cwd = resolve(CACHE.activeRootPath, cwd);
405+
if (!cwd || !existsSync(resolve(_cwd, "token.config.json"))) {
405406
LOGGER.error("TokenCSS Config not found in: ", resolve(cwd));
406407
return null;
407408
}
408-
const _cwd = resolve(cwd);
409409
// VSCode/Electron does not support ESM modules, thus it becomes important to bundle them
410410
// with the code to make it work.
411411
try {

0 commit comments

Comments
 (0)