cssContext() — tailwindcss Function Reference
Architecture documentation for the cssContext() function in ast.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 94749bfc_586d_a227_ed27_a6fae4004c50["cssContext()"] b9cbffa4_c352_cf3c_268f_cbb174fb3a47["ast.ts"] 94749bfc_586d_a227_ed27_a6fae4004c50 -->|defined in| b9cbffa4_c352_cf3c_268f_cbb174fb3a47 5701b75f_30db_85c0_f5db_cc19be325e05["applyCompatibilityHooks()"] 5701b75f_30db_85c0_f5db_cc19be325e05 -->|calls| 94749bfc_586d_a227_ed27_a6fae4004c50 2351a59d_92ba_1342_1dcb_39b34492170e["upgradeToFullPluginSupport()"] 2351a59d_92ba_1342_1dcb_39b34492170e -->|calls| 94749bfc_586d_a227_ed27_a6fae4004c50 f7f9b3da_5977_1aa6_3bcb_bfc607af4e8f["parseCss()"] f7f9b3da_5977_1aa6_3bcb_bfc607af4e8f -->|calls| 94749bfc_586d_a227_ed27_a6fae4004c50 b75d79c9_e7f1_5470_9b5b_82bcda89d98f["context()"] 94749bfc_586d_a227_ed27_a6fae4004c50 -->|calls| b75d79c9_e7f1_5470_9b5b_82bcda89d98f style 94749bfc_586d_a227_ed27_a6fae4004c50 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/tailwindcss/src/ast.ts lines 188–216
export function cssContext(
ctx: VisitContext<AstNode>,
): VisitContext<AstNode> & { context: Record<string, string | boolean> } {
return {
depth: ctx.depth,
get context() {
let context: Record<string, string | boolean> = {}
for (let child of ctx.path()) {
if (child.kind === 'context') {
Object.assign(context, child.context)
}
}
// Once computed, we never need to compute this again
Object.defineProperty(this, 'context', { value: context })
return context
},
get parent() {
let parent = (this.path().pop() as Extract<AstNode, { nodes: AstNode[] }>) ?? null
// Once computed, we never need to compute this again
Object.defineProperty(this, 'parent', { value: parent })
return parent
},
path() {
return ctx.path().filter((n) => n.kind !== 'context')
},
}
}
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does cssContext() do?
cssContext() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/ast.ts.
Where is cssContext() defined?
cssContext() is defined in packages/tailwindcss/src/ast.ts at line 188.
What does cssContext() call?
cssContext() calls 1 function(s): context.
What calls cssContext()?
cssContext() is called by 3 function(s): applyCompatibilityHooks, parseCss, upgradeToFullPluginSupport.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free