getPropertySort() — tailwindcss Function Reference
Architecture documentation for the getPropertySort() function in compile.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD e0256065_d4b7_9362_cc77_233a58f9282b["getPropertySort()"] 214bac69_e516_bea4_67fa_4e9e092ced3b["compile.ts"] e0256065_d4b7_9362_cc77_233a58f9282b -->|defined in| 214bac69_e516_bea4_67fa_4e9e092ced3b e57db502_ed4e_4f14_1b2a_b25af3c0477d["compileAstNodes()"] e57db502_ed4e_4f14_1b2a_b25af3c0477d -->|calls| e0256065_d4b7_9362_cc77_233a58f9282b style e0256065_d4b7_9362_cc77_233a58f9282b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/tailwindcss/src/compile.ts lines 325–367
function getPropertySort(nodes: AstNode[]) {
// Determine sort order based on properties used
let order = new Set<number>()
let count = 0
let q: AstNode[] = nodes.slice()
let seenTwSort = false
while (q.length > 0) {
// SAFETY: At this point it is safe to use TypeScript's non-null assertion
// operator because we guarded against `q.length > 0` above.
let node = q.shift()!
if (node.kind === 'declaration') {
// Empty strings should still be counted, e.g.: `--tw-foo:;` is valid
if (node.value === undefined) continue
count++
if (seenTwSort) continue
if (node.property === '--tw-sort') {
let idx = GLOBAL_PROPERTY_ORDER.indexOf(node.value ?? '')
if (idx !== -1) {
order.add(idx)
seenTwSort = true
continue
}
}
let idx = GLOBAL_PROPERTY_ORDER.indexOf(node.property)
if (idx !== -1) order.add(idx)
} else if (node.kind === 'rule' || node.kind === 'at-rule') {
for (let child of node.nodes) {
q.push(child)
}
}
}
return {
order: Array.from(order).sort((a, z) => a - z),
count,
}
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does getPropertySort() do?
getPropertySort() is a function in the tailwindcss codebase, defined in packages/tailwindcss/src/compile.ts.
Where is getPropertySort() defined?
getPropertySort() is defined in packages/tailwindcss/src/compile.ts at line 325.
What calls getPropertySort()?
getPropertySort() is called by 1 function(s): compileAstNodes.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free