Skip to content

Commit 0b0e7f3

Browse files
committed
Support loading plugins and configs
1 parent 28c592f commit 0b0e7f3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packages/tailwindcss-language-server/src/util/v4/design-system.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { DesignSystem } from '@tailwindcss/language-service/src/util/v4'
22

33
import postcss from 'postcss'
44
import { resolveCssImports } from '../../css'
5+
import { resolveFrom } from '../resolveFrom'
56

67
const HAS_V4_IMPORT = /@import\s*(?:'tailwindcss'|"tailwindcss")/
78
const HAS_V4_THEME = /@theme\s*\{/
@@ -38,8 +39,16 @@ export async function loadDesignSystem(
3839

3940
// Step 3: Take the resolved CSS and pass it to v4's `loadDesignSystem`
4041
let design: DesignSystem = await tailwindcss.__unstable__loadDesignSystem(resolved.css, {
41-
loadPlugin() {
42-
return () => {}
42+
async loadPlugin(id: string) {
43+
let resolvedPath = resolveFrom(filepath, id)
44+
45+
return import(resolvedPath).then((m) => m.default ?? m)
46+
},
47+
48+
async loadConfig(id: string) {
49+
let resolvedPath = resolveFrom(filepath, id)
50+
51+
return import(resolvedPath).then((m) => m.default ?? m)
4352
},
4453
})
4554

0 commit comments

Comments
 (0)