compileAstNodes() — tailwindcss Function Reference
Architecture documentation for the compileAstNodes() function in compile.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 3ea56425_6e9f_0dc3_e68f_304ee638d53d["compileAstNodes()"] cbdeac33_581c_3396_0f10_877935a68176["compileCandidates()"] cbdeac33_581c_3396_0f10_877935a68176 -->|calls| 3ea56425_6e9f_0dc3_e68f_304ee638d53d cebe77e1_f0f2_aeee_417e_2192f5790344["buildDesignSystem()"] cebe77e1_f0f2_aeee_417e_2192f5790344 -->|calls| 3ea56425_6e9f_0dc3_e68f_304ee638d53d b6aaa1cb_54ef_7dee_8d81_ee36d2da08a7["compileBaseUtility()"] 3ea56425_6e9f_0dc3_e68f_304ee638d53d -->|calls| b6aaa1cb_54ef_7dee_8d81_ee36d2da08a7 22e232f7_919c_8490_d3d0_2af2fca034d5["escape()"] 3ea56425_6e9f_0dc3_e68f_304ee638d53d -->|calls| 22e232f7_919c_8490_d3d0_2af2fca034d5 9fbe1889_1930_4e64_e59e_7adef2fbbf13["getPropertySort()"] 3ea56425_6e9f_0dc3_e68f_304ee638d53d -->|calls| 9fbe1889_1930_4e64_e59e_7adef2fbbf13 027a694e_1c93_8659_e94f_8a2869bb7124["applyImportant()"] 3ea56425_6e9f_0dc3_e68f_304ee638d53d -->|calls| 027a694e_1c93_8659_e94f_8a2869bb7124 8bb120ad_8027_cede_007f_1d5351f7ca96["applyVariant()"] 3ea56425_6e9f_0dc3_e68f_304ee638d53d -->|calls| 8bb120ad_8027_cede_007f_1d5351f7ca96 style 3ea56425_6e9f_0dc3_e68f_304ee638d53d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/tailwindcss/src/compile.ts lines 123–175
export function compileAstNodes(
candidate: Candidate,
designSystem: DesignSystem,
flags: CompileAstFlags,
) {
let asts = compileBaseUtility(candidate, designSystem)
if (asts.length === 0) return []
let respectImportant = designSystem.important && Boolean(flags & CompileAstFlags.RespectImportant)
let rules: {
node: AstNode
propertySort: {
order: number[]
count: number
}
}[] = []
let selector = `.${escape(candidate.raw)}`
for (let nodes of asts) {
let propertySort = getPropertySort(nodes)
// If the candidate itself is important then we want to always mark
// the utility as important. However, at a design system level we want
// to be able to opt-out when using things like `@apply`
if (candidate.important || respectImportant) {
applyImportant(nodes)
}
let node: StyleRule = {
kind: 'rule',
selector,
nodes,
}
for (let variant of candidate.variants) {
let result = applyVariant(node, variant, designSystem.variants)
// When the variant results in `null`, it means that the variant cannot be
// applied to the rule. Discard the candidate and continue to the next
// one.
if (result === null) return []
}
rules.push({
node,
propertySort,
})
}
return rules
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does compileAstNodes() do?
compileAstNodes() is a function in the tailwindcss codebase.
What does compileAstNodes() call?
compileAstNodes() calls 5 function(s): applyImportant, applyVariant, compileBaseUtility, escape, getPropertySort.
What calls compileAstNodes()?
compileAstNodes() is called by 2 function(s): buildDesignSystem, compileCandidates.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free