Skip to content

Commit 8266d6b

Browse files
authored
Resolve helper functions in CSS previews (#766)
1 parent 2ddb1f9 commit 8266d6b

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

packages/tailwindcss-language-server/src/server.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,13 @@ async function createProjectService(
767767
.default
768768
),
769769
},
770+
evaluateTailwindFunctions: {
771+
module: firstOptional(
772+
() =>
773+
require(resolveFrom(configDir, 'tailwindcss/lib/lib/evaluateTailwindFunctions'))
774+
.default
775+
),
776+
},
770777
}
771778
} catch (_) {
772779
try {

packages/tailwindcss-language-service/src/util/jit.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export function generateRules(
1818

1919
let root = state.modules.postcss.module.root({ nodes: rules.map(([, rule]) => rule) })
2020
state.modules.jit.expandApplyAtRules.module(state.jitContext)(root)
21+
state.modules.jit.evaluateTailwindFunctions?.module?.(state.jitContext)(root)
2122

2223
let actualRules: Rule[] = []
2324
root.walkRules((subRule) => {

packages/tailwindcss-language-service/src/util/state.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export interface State {
110110
generateRules: { module: any }
111111
createContext: { module: any }
112112
expandApplyAtRules: { module: any }
113+
evaluateTailwindFunctions?: { module: any }
113114
}
114115
}
115116
browserslist?: string[]

0 commit comments

Comments
 (0)