Skip to content

Commit d5d8d2a

Browse files
committed
Fallback to v4 by default
1 parent 07137cb commit d5d8d2a

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/config.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export async function getTailwindConfig(options: ParserOptions): Promise<any> {
7575
//
7676
// For the same reasons as the v4 stylesheet, it's important that the config
7777
// file be resolved relative to the file it's configured in.
78-
if (!stylesheet && !mod?.__unstable__loadDesignSystem) {
78+
if (!stylesheet && mod && !mod.__unstable__loadDesignSystem) {
7979
jsConfig = jsConfig ?? findClosestJsConfig(inputDir)
8080
}
8181

@@ -112,14 +112,6 @@ export async function getTailwindConfig(options: ParserOptions): Promise<any> {
112112
stylesheet ??= `${pkgDir}/theme.css`
113113
}
114114

115-
// No stylesheet was given or otherwise found in a local v4 installation
116-
// nor was a tailwind config given or found.
117-
//
118-
// Fallback to v3
119-
if (!stylesheet) {
120-
return pathToApiMap.remember(null, () => loadV3(null, null))
121-
}
122-
123115
return pathToApiMap.remember(`${pkgDir}:${stylesheet}`, () => loadV4(mod, stylesheet))
124116
}
125117

tests/format.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ describe('other', () => {
2626

2727
expect(result).toEqual('<div class="unknown-class group peer container p-0"></div>')
2828
})
29+
30+
test('parasite utilities', async ({ expect }) => {
31+
let result = await format('<div class="group peer unknown-class p-0 container"></div>')
32+
33+
expect(result).toEqual('<div class="group peer unknown-class container p-0"></div>')
34+
})
2935
})
3036

3137
describe('whitespace', () => {
@@ -61,6 +67,6 @@ describe('whitespace', () => {
6167
test('duplicate classes are dropped', async ({ expect }) => {
6268
let result = await format('<div class="underline line-through underline flex"></div>')
6369

64-
expect(result).toEqual('<div class="flex underline line-through"></div>')
70+
expect(result).toEqual('<div class="flex line-through underline"></div>')
6571
})
6672
})

0 commit comments

Comments
 (0)