Skip to content

Commit df46604

Browse files
committed
look for tailwindcss in subdirs (#1)
1 parent 99a8434 commit df46604

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/extension.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict'
22

33
import * as vscode from 'vscode'
4-
import { join } from 'path'
4+
import { join, dirname } from 'path'
55
const tailwindClassNames = require('tailwind-class-names')
66
const dlv = require('dlv')
77
const Color = require('color')
@@ -64,16 +64,21 @@ async function getTailwind() {
6464
'**/node_modules/**',
6565
1
6666
)
67-
if (!files) return null
67+
68+
if (!files.length) return null
6869

6970
let configPath = files[0].fsPath
7071

71-
const pluginPath = join(
72-
vscode.workspace.workspaceFolders[0].uri.fsPath,
73-
'node_modules',
74-
'tailwindcss'
72+
let tailwindPackage = await vscode.workspace.findFiles(
73+
'**/node_modules/tailwindcss/package.json',
74+
null,
75+
1
7576
)
7677

78+
if (!tailwindPackage.length) return null
79+
80+
let pluginPath = dirname(tailwindPackage[0].fsPath)
81+
7782
let tw
7883

7984
try {

0 commit comments

Comments
 (0)