@@ -7,13 +7,29 @@ import locatePath from 'locate-path'
7
7
8
8
import type { Configuration } from 'twind'
9
9
10
- const CONFIG_FILES = [ 'twind.config.ts' , 'twind.config.mjs' , 'twind.config.js' , 'twind.config.cjs' ]
10
+ const TWIND_CONFIG_FILES = [
11
+ 'twind.config.ts' ,
12
+ 'twind.config.mjs' ,
13
+ 'twind.config.js' ,
14
+ 'twind.config.cjs' ,
15
+ ]
11
16
17
+ const TAILWIND_CONFIG_FILES = [
18
+ 'tailwind.config.ts' ,
19
+ 'tailwind.config.mjs' ,
20
+ 'tailwind.config.js' ,
21
+ 'tailwind.config.cjs' ,
22
+ ]
23
+
24
+ // TODO use typescript to check files
25
+ // this.typescript.server.toNormalizedPath(fileName)
26
+ // info.project.containsFile()
12
27
export const findConfig = ( cwd = process . cwd ( ) ) : string | undefined =>
13
- locatePath . sync ( CONFIG_FILES . map ( ( file ) => Path . resolve ( cwd , 'config' , file ) ) ) ||
14
- locatePath . sync ( CONFIG_FILES . map ( ( file ) => Path . resolve ( cwd , 'src' , file ) ) ) ||
15
- locatePath . sync ( CONFIG_FILES . map ( ( file ) => Path . resolve ( cwd , 'public' , file ) ) ) ||
16
- findUp . sync ( CONFIG_FILES , { cwd } )
28
+ locatePath . sync ( TWIND_CONFIG_FILES . map ( ( file ) => Path . resolve ( cwd , 'config' , file ) ) ) ||
29
+ locatePath . sync ( TWIND_CONFIG_FILES . map ( ( file ) => Path . resolve ( cwd , 'src' , file ) ) ) ||
30
+ locatePath . sync ( TWIND_CONFIG_FILES . map ( ( file ) => Path . resolve ( cwd , 'public' , file ) ) ) ||
31
+ findUp . sync ( TWIND_CONFIG_FILES , { cwd } ) ||
32
+ findUp . sync ( TAILWIND_CONFIG_FILES , { cwd } )
17
33
18
34
export const loadConfig = ( configFile : string , cwd = process . cwd ( ) ) : Configuration => {
19
35
const result = buildSync ( {
0 commit comments