Skip to content

Commit baa2ec8

Browse files
committed
fix: ignore imports incomplete paths #97
1 parent 65f9f3a commit baa2ec8

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

TASKS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- Doing this still shows `open-props/open-props.min.css` in the autocomplete/definition-provider list.
1616
- Support variable defaults syntax as well, like the following:
1717
- `color: var(--color, #333)`, this is a valid syntax.
18+
- `cssvar.enable` disables the extension entirely. It is not scoped for each root folder.
1819

1920

2021
## Notes:

examples/css-imports/index.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
/* Following is very specific to webpack/react projects */
1111
/* I won't be supporting this in this extension, as a user can import */
1212
/* such css files from extension settings */
13-
/* @import '~open-props/open-props.min.css' */
13+
/* But's it's wise to ignore such imports */
14+
@import '~open-props/open-props.min.css';
15+
@import 'modern-normalize/modern-normalize.css';
1416

1517
@import url('node_modules/open-props/red.min.css') layer(utilities) print, screen;
1618

@@ -29,4 +31,5 @@ body {
2931
background-color: var(--c-blue);
3032
border-top-color: var(--orange-2);
3133
box-shadow: 0 0 3px 0 var(--violet-2);
34+
margin: var(--size-10);
3235
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
:root {
2+
--pop: violet;
3+
--chop1: var(--pop);
4+
--chop2: var(--chop1);
5+
}
6+
7+
body {
8+
color: var(--chop2);
9+
}

src/parser.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@ const parseFile = async function (
290290
}, {} as CSSVarLocation);
291291
}
292292
if (acceptedFile && !allLocalFiles.includes(acceptedFile.local)) {
293-
resolvedPaths.push(acceptedFile);
293+
if (Object.keys(acceptedFile).length !== 0) {
294+
resolvedPaths.push(acceptedFile);
295+
}
294296
}
295297
}
296298
}

0 commit comments

Comments
 (0)