createSpacingCache() — tailwindcss Function Reference
Architecture documentation for the createSpacingCache() function in canonicalize-candidates.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 6f581ee0_818b_dbd1_5d05_0b64a3da62bd["createSpacingCache()"] 7d350d81_5de1_f9f3_5b2c_19ec8fd3c37e["canonicalize-candidates.ts"] 6f581ee0_818b_dbd1_5d05_0b64a3da62bd -->|defined in| 7d350d81_5de1_f9f3_5b2c_19ec8fd3c37e 81ec8f98_1fb2_d7c3_dd65_3a9e51b3be39["prepareDesignSystemStorage()"] 81ec8f98_1fb2_d7c3_dd65_3a9e51b3be39 -->|calls| 6f581ee0_818b_dbd1_5d05_0b64a3da62bd 80c6b9c7_f7d5_21ff_a3e4_25ec4a08f640["resolveThemeValue()"] 6f581ee0_818b_dbd1_5d05_0b64a3da62bd -->|calls| 80c6b9c7_f7d5_21ff_a3e4_25ec4a08f640 9ab273b1_6701_5494_7f88_e2e72f74ddf7["constantFoldDeclaration()"] 6f581ee0_818b_dbd1_5d05_0b64a3da62bd -->|calls| 9ab273b1_6701_5494_7f88_e2e72f74ddf7 5bcf4886_1230_a8ff_7302_a26cc5a9a525["get()"] 6f581ee0_818b_dbd1_5d05_0b64a3da62bd -->|calls| 5bcf4886_1230_a8ff_7302_a26cc5a9a525 style 6f581ee0_818b_dbd1_5d05_0b64a3da62bd 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, defined in packages/tailwindcss/src/canonicalize-candidates.ts.
Where is createSpacingCache() defined?
createSpacingCache() is defined in packages/tailwindcss/src/canonicalize-candidates.ts at line 937.
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