File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
packages/tailwindcss-language-server/src Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -531,6 +531,28 @@ testLocator({
531
531
] ,
532
532
} )
533
533
534
+ testLocator ( {
535
+ name : 'Stylesheets that only have URL imports are not considered roots' ,
536
+ fs : {
537
+ 'a/fonts.css' : css `
538
+ @import 'https://example.com/fonts/some-font.css';
539
+ .a {
540
+ color: red;
541
+ }
542
+ ` ,
543
+ 'src/app.css' : css `
544
+ @import 'tailwindcss';
545
+ ` ,
546
+ } ,
547
+ expected : [
548
+ {
549
+ version : '4.1.1 (bundled)' ,
550
+ config : '/src/app.css' ,
551
+ content : [ ] ,
552
+ } ,
553
+ ] ,
554
+ } )
555
+
534
556
// ---
535
557
536
558
function testLocator ( {
Original file line number Diff line number Diff line change @@ -49,7 +49,8 @@ const HAS_TAILWIND = /@tailwind\s*[^;]+;/
49
49
const HAS_COMMON_DIRECTIVE = / @ ( c o n f i g | a p p l y ) \s * [ ^ ; { ] + [ ; { ] /
50
50
51
51
// If it's got imports at all it could be either
52
- const HAS_IMPORT = / @ i m p o r t \s * [ ' " ] /
52
+ // Note: We only care about non-url imports
53
+ const HAS_NON_URL_IMPORT = / @ i m p o r t \s * [ ' " ] (? ! ( [ a - z ] + : | \/ \/ ) ) /
53
54
54
55
/**
55
56
* Determine the likely Tailwind version used by the given file
@@ -128,7 +129,7 @@ export function analyzeStylesheet(content: string): TailwindStylesheet {
128
129
}
129
130
130
131
// Files that import other files could be either and are potentially roots
131
- if ( HAS_IMPORT . test ( content ) ) {
132
+ if ( HAS_NON_URL_IMPORT . test ( content ) ) {
132
133
return {
133
134
root : true ,
134
135
versions : [ '4' , '3' ] ,
You can’t perform that action at this time.
0 commit comments