createSpacingCache() — tailwindcss Function Reference
Architecture documentation for the createSpacingCache() function in canonicalize-candidates.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 0043d7b5_bba3_2709_5125_355abd3b6888["createSpacingCache()"] 207ada18_60f2_10b9_7c9e_99bdb32f4ed7["prepareDesignSystemStorage()"] 207ada18_60f2_10b9_7c9e_99bdb32f4ed7 -->|calls| 0043d7b5_bba3_2709_5125_355abd3b6888 4b7a4cd6_9f02_0b91_8991_3889a44cd62f["resolveThemeValue()"] 0043d7b5_bba3_2709_5125_355abd3b6888 -->|calls| 4b7a4cd6_9f02_0b91_8991_3889a44cd62f 3a1a48b0_f593_6ef7_a2a2_e2d97f76468f["constantFoldDeclaration()"] 0043d7b5_bba3_2709_5125_355abd3b6888 -->|calls| 3a1a48b0_f593_6ef7_a2a2_e2d97f76468f 0aa64a1c_efd8_a69d_48ed_649b7a86c854["get()"] 0043d7b5_bba3_2709_5125_355abd3b6888 -->|calls| 0aa64a1c_efd8_a69d_48ed_649b7a86c854 style 0043d7b5_bba3_2709_5125_355abd3b6888 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/tailwindcss/src/canonicalize-candidates.ts lines 937–965
function createSpacingCache(
designSystem: DesignSystem,
options?: CanonicalizeOptions,
): DesignSystem['storage'][typeof SPACING_KEY] {
let spacingMultiplier = designSystem.resolveThemeValue('--spacing')
if (spacingMultiplier === undefined) return null
spacingMultiplier = constantFoldDeclaration(spacingMultiplier, options?.rem ?? null)
let parsed = dimensions.get(spacingMultiplier)
if (!parsed) return null
let [value, unit] = parsed
return new DefaultMap<string, number | null>((input) => {
// If we already know that the spacing multiplier is 0, all spacing
// multipliers will also be 0. No need to even try and parse/canonicalize
// the input value.
if (value === 0) return null
let parsed = dimensions.get(constantFoldDeclaration(input, options?.rem ?? null))
if (!parsed) return null
let [myValue, myUnit] = parsed
if (myUnit !== unit) return null
return myValue / value
})
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does createSpacingCache() do?
createSpacingCache() is a function in the tailwindcss codebase.
What does createSpacingCache() call?
createSpacingCache() calls 3 function(s): constantFoldDeclaration, get, resolveThemeValue.
What calls createSpacingCache()?
createSpacingCache() is called by 1 function(s): prepareDesignSystemStorage.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free