Resolve helper functions in CSS previews (#766)

master
Brad Cornes 2023-04-25 16:47:12 +01:00 committed by GitHub
parent 2ddb1f93f8
commit 8266d6b0aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View File

@ -767,6 +767,13 @@ async function createProjectService(
.default .default
), ),
}, },
evaluateTailwindFunctions: {
module: firstOptional(
() =>
require(resolveFrom(configDir, 'tailwindcss/lib/lib/evaluateTailwindFunctions'))
.default
),
},
} }
} catch (_) { } catch (_) {
try { try {

View File

@ -18,6 +18,7 @@ export function generateRules(
let root = state.modules.postcss.module.root({ nodes: rules.map(([, rule]) => rule) }) let root = state.modules.postcss.module.root({ nodes: rules.map(([, rule]) => rule) })
state.modules.jit.expandApplyAtRules.module(state.jitContext)(root) state.modules.jit.expandApplyAtRules.module(state.jitContext)(root)
state.modules.jit.evaluateTailwindFunctions?.module?.(state.jitContext)(root)
let actualRules: Rule[] = [] let actualRules: Rule[] = []
root.walkRules((subRule) => { root.walkRules((subRule) => {

View File

@ -110,6 +110,7 @@ export interface State {
generateRules: { module: any } generateRules: { module: any }
createContext: { module: any } createContext: { module: any }
expandApplyAtRules: { module: any } expandApplyAtRules: { module: any }
evaluateTailwindFunctions?: { module: any }
} }
} }
browserslist?: string[] browserslist?: string[]