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({
531531 ] ,
532532} )
533533
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+
534556// ---
535557
536558function testLocator ( {
Original file line number Diff line number Diff line change @@ -49,7 +49,8 @@ const HAS_TAILWIND = /@tailwind\s*[^;]+;/
4949const HAS_COMMON_DIRECTIVE = / @ ( c o n f i g | a p p l y ) \s * [ ^ ; { ] + [ ; { ] /
5050
5151// 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 ] + : | \/ \/ ) ) /
5354
5455/**
5556 * Determine the likely Tailwind version used by the given file
@@ -128,7 +129,7 @@ export function analyzeStylesheet(content: string): TailwindStylesheet {
128129 }
129130
130131 // 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 ) ) {
132133 return {
133134 root : true ,
134135 versions : [ '4' , '3' ] ,
You can’t perform that action at this time.
0 commit comments