Skip to content

Commit 5253d6e

Browse files
committed
Resolve tailwindcss relative to the file being processed
Still needs performance testing to make sure this isn’t a massive performance penalty
1 parent e4072ec commit 5253d6e

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

src/config.ts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ async function getPrettierConfigPath(
7979
): Promise<string | null> {
8080
// Locating the config file can be mildly expensive so we cache it temporarily
8181
let existingPath = prettierConfigCache.get(options.filepath)
82-
if (existingPath !== undefined) {
83-
return existingPath
84-
}
82+
if (existingPath !== undefined) return existingPath
8583

8684
let path = await prettier.resolveConfigFile(options.filepath)
8785
prettierConfigCache.set(options.filepath, path)
@@ -90,21 +88,10 @@ async function getPrettierConfigPath(
9088
}
9189

9290
async function getBaseDir(options: ParserOptions): Promise<string> {
93-
let prettierConfigPath = await getPrettierConfigPath(options)
94-
95-
if (options.tailwindConfig) {
96-
return prettierConfigPath ? path.dirname(prettierConfigPath) : process.cwd()
97-
}
91+
if (options.filepath) return path.dirname(options.filepath)
9892

99-
if (options.tailwindEntryPoint) {
100-
return prettierConfigPath ? path.dirname(prettierConfigPath) : process.cwd()
101-
}
102-
103-
return prettierConfigPath
104-
? path.dirname(prettierConfigPath)
105-
: options.filepath
106-
? path.dirname(options.filepath)
107-
: process.cwd()
93+
let prettierConfigPath = await getPrettierConfigPath(options)
94+
return prettierConfigPath ? path.dirname(prettierConfigPath) : process.cwd()
10895
}
10996

11097
async function loadTailwindConfig(

0 commit comments

Comments
 (0)