MCPcopy
hub / github.com/tailwindlabs/tailwindcss / parseVariantValue

Function parseVariantValue

packages/tailwindcss/src/compat/plugin-api.ts:602–614  ·  packages/tailwindcss/src/compat/plugin-api.ts::parseVariantValue
(resolved: string | string[], nodes: AstNode[])

Source from the content-addressed store, hash-verified

600}
601
602function parseVariantValue(resolved: string | string[], nodes: AstNode[]): AstNode[] {
603 let resolvedArray = typeof resolved === class="st">'string' ? [resolved] : resolved
604 return resolvedArray.flatMap((r) => {
605 if (r.trim().endsWith(class="st">'}')) {
606 let updatedCSS = r.replace(class="st">'}', class="st">'{@slot}}')
607 let ast = CSS.parse(updatedCSS)
608 substituteAtSlot(ast, nodes)
609 return ast
610 } else {
611 return rule(r, nodes)
612 }
613 })
614}
615
616type Primitive = string | number | boolean | null
617export type CssPluginOptions = Record<string, Primitive | Primitive[]>

Callers 2

addVariantFunction · 0.85
resolveVariantValueFunction · 0.85

Calls 2

substituteAtSlotFunction · 0.90
ruleFunction · 0.90

Tested by

no test coverage detected