look for tailwindcss in subdirs (#1)

master
Brad Cornes 2018-08-21 16:38:15 +01:00
parent 99a84344f1
commit df4660435c
1 changed files with 11 additions and 6 deletions

View File

@ -1,7 +1,7 @@
'use strict' 'use strict'
import * as vscode from 'vscode' import * as vscode from 'vscode'
import { join } from 'path' import { join, dirname } from 'path'
const tailwindClassNames = require('tailwind-class-names') const tailwindClassNames = require('tailwind-class-names')
const dlv = require('dlv') const dlv = require('dlv')
const Color = require('color') const Color = require('color')
@ -64,16 +64,21 @@ async function getTailwind() {
'**/node_modules/**', '**/node_modules/**',
1 1
) )
if (!files) return null
if (!files.length) return null
let configPath = files[0].fsPath let configPath = files[0].fsPath
const pluginPath = join( let tailwindPackage = await vscode.workspace.findFiles(
vscode.workspace.workspaceFolders[0].uri.fsPath, '**/node_modules/tailwindcss/package.json',
'node_modules', null,
'tailwindcss' 1
) )
if (!tailwindPackage.length) return null
let pluginPath = dirname(tailwindPackage[0].fsPath)
let tw let tw
try { try {