Skip to content

Commit 07137cb

Browse files
committed
Add fallback for v4
1 parent e07af2e commit 07137cb

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

package-lock.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
"resolve-from": "^5.0.0",
7373
"rimraf": "^6.0.1",
7474
"svelte": "^5.38.2",
75+
"tailwindcss": "^4.1.12",
7576
"tailwindcss-v3": "npm:tailwindcss@^3.4.17",
7677
"tsup": "^8.5.0",
7778
"vitest": "^3.2.4"

src/versions/v4.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
// @ts-check
21
import * as fs from 'fs/promises'
32
import * as path from 'path'
43
import { pathToFileURL } from 'url'
54
import { createJiti, type Jiti } from 'jiti'
6-
import postcss from 'postcss'
5+
import { __unstable__loadDesignSystem } from 'tailwindcss'
76
// @ts-ignore
8-
import postcssImport from 'postcss-import'
7+
import themeCss from 'tailwindcss/theme.css'
98
import { resolveCssFrom, resolveJsFrom } from '../resolve'
109
import type { UnifiedApi } from '../types'
1110

@@ -44,9 +43,7 @@ interface ApiV4 {
4443
export async function loadV4(mod: ApiV4 | null, stylesheet: string | null): Promise<UnifiedApi> {
4544
// This is not Tailwind v4
4645
if (!mod || !mod.__unstable__loadDesignSystem) {
47-
throw new Error('TODO')
48-
// TODO
49-
// mod = (await import('tailwindcss-v4')) as ApiV4
46+
mod = (await import('tailwindcss')) as ApiV4
5047
}
5148

5249
// Create a Jiti instance that can be used to load plugins and config files
@@ -65,9 +62,7 @@ export async function loadV4(mod: ApiV4 | null, stylesheet: string | null): Prom
6562
} else {
6663
importBasePath = process.cwd()
6764
stylesheet = path.join(importBasePath, 'fake.css')
68-
69-
// TODO: bundled theme.css file?
70-
css = ''
65+
css = themeCss
7166
}
7267

7368
// Load the design system and set up a compatible context object that is

0 commit comments

Comments
 (0)