Skip to content

Commit 2967129

Browse files
committed
Don’t show syntax error for @import … source(…)
1 parent b124e83 commit 2967129

File tree

1 file changed

+6
-0
lines changed
  • packages/tailwindcss-language-server/src/language

1 file changed

+6
-0
lines changed

packages/tailwindcss-language-server/src/language/cssServer.ts

+6
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,12 @@ function createVirtualCssDocument(textDocument: TextDocument): TextDocument {
346346
/@media(\s+screen\s*\([^)]+\))/g,
347347
(_match, screen) => `@media (${MEDIA_MARKER})${' '.repeat(screen.length - 4)}`,
348348
)
349+
// Replace `@import "…" source()` with `@import "…"` otherwise we'll
350+
// get warnings about expecting a semi-colon instead of the source function
351+
.replace(
352+
/@import\s*("(?:[^"]+)"|'(?:[^']+)')\s*source\([^)]+\)/g,
353+
(_match, url) => `@import "${url.slice(1, -1)}"`,
354+
)
349355
.replace(/(?<=\b(?:theme|config)\([^)]*)[.[\]]/g, '_')
350356

351357
return TextDocument.create(

0 commit comments

Comments
 (0)