printCandidate() — tailwindcss Function Reference
Architecture documentation for the printCandidate() function in candidate.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 4c29981d_a61a_00fb_b3b5_5a69228c4fff["printCandidate()"] 7be152ff_3d54_3c38_8abe_56a34c91bb4d["printUnprefixedCandidate()"] 7be152ff_3d54_3c38_8abe_56a34c91bb4d -->|calls| 4c29981d_a61a_00fb_b3b5_5a69228c4fff 707ef5d3_1654_7094_06d2_99e8004cab43["migrateArbitraryVariants()"] 707ef5d3_1654_7094_06d2_99e8004cab43 -->|calls| 4c29981d_a61a_00fb_b3b5_5a69228c4fff 0d34c838_b3bc_b388_6b0d_17fe24312e5f["migrateAutomaticVarInjection()"] 0d34c838_b3bc_b388_6b0d_17fe24312e5f -->|calls| 4c29981d_a61a_00fb_b3b5_5a69228c4fff 4d31f3a8_5ec2_6651_828a_48dc621934f5["migrateCamelcaseInNamedValue()"] 4d31f3a8_5ec2_6651_828a_48dc621934f5 -->|calls| 4c29981d_a61a_00fb_b3b5_5a69228c4fff c54c0b46_6508_253f_e6ff_d96bcc4246d5["migrateLegacyArbitraryValues()"] c54c0b46_6508_253f_e6ff_d96bcc4246d5 -->|calls| 4c29981d_a61a_00fb_b3b5_5a69228c4fff 83b8a939_5e80_0880_4db2_753e6d6e279c["migrateLegacyClasses()"] 83b8a939_5e80_0880_4db2_753e6d6e279c -->|calls| 4c29981d_a61a_00fb_b3b5_5a69228c4fff 042344d6_c400_b6f0_00d2_ff8fded428bc["migrateModernizeArbitraryValues()"] 042344d6_c400_b6f0_00d2_ff8fded428bc -->|calls| 4c29981d_a61a_00fb_b3b5_5a69228c4fff f18be462_61dc_36f7_156d_7e1323554ba7["migratePrefix()"] f18be462_61dc_36f7_156d_7e1323554ba7 -->|calls| 4c29981d_a61a_00fb_b3b5_5a69228c4fff 52b790cf_9f93_aadf_60b7_6333be12e6cb["migrateVariantOrder()"] 52b790cf_9f93_aadf_60b7_6333be12e6cb -->|calls| 4c29981d_a61a_00fb_b3b5_5a69228c4fff 85c01f92_2868_9f10_aa0d_1b8b6eaeaaa3["createCanonicalizeCandidateCache()"] 85c01f92_2868_9f10_aa0d_1b8b6eaeaaa3 -->|calls| 4c29981d_a61a_00fb_b3b5_5a69228c4fff 19c705c9_6183_f093_b0c2_334f2d300052["createCanonicalizeUtilityCache()"] 19c705c9_6183_f093_b0c2_334f2d300052 -->|calls| 4c29981d_a61a_00fb_b3b5_5a69228c4fff 4ecd38ab_ffd3_a327_598e_f401f4635827["printUnprefixedCandidate()"] 4ecd38ab_ffd3_a327_598e_f401f4635827 -->|calls| 4c29981d_a61a_00fb_b3b5_5a69228c4fff 96c91904_da91_37f1_9ad1_9d3e9e197781["arbitraryUtilities()"] 96c91904_da91_37f1_9ad1_9d3e9e197781 -->|calls| 4c29981d_a61a_00fb_b3b5_5a69228c4fff 6fea9ec3_967d_9508_b278_ec5bbd5afb24["allVariablesAreUsed()"] 6fea9ec3_967d_9508_b278_ec5bbd5afb24 -->|calls| 4c29981d_a61a_00fb_b3b5_5a69228c4fff style 4c29981d_a61a_00fb_b3b5_5a69228c4fff fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/tailwindcss/src/candidate.ts lines 907–967
export function printCandidate(designSystem: DesignSystem, candidate: Candidate) {
let parts: string[] = []
for (let variant of candidate.variants) {
parts.unshift(printVariant(variant))
}
// Handle prefix
if (designSystem.theme.prefix) {
parts.unshift(designSystem.theme.prefix)
}
let base: string = ''
// Handle static
if (candidate.kind === 'static') {
base += candidate.root
}
// Handle functional
if (candidate.kind === 'functional') {
base += candidate.root
if (candidate.value) {
if (candidate.value.kind === 'arbitrary') {
if (candidate.value !== null) {
let isVarValue = isVar(candidate.value.value)
let value = isVarValue ? candidate.value.value.slice(4, -1) : candidate.value.value
let [open, close] = isVarValue ? ['(', ')'] : ['[', ']']
if (candidate.value.dataType) {
base += `-${open}${candidate.value.dataType}:${printArbitraryValue(value)}${close}`
} else {
base += `-${open}${printArbitraryValue(value)}${close}`
}
}
} else if (candidate.value.kind === 'named') {
base += `-${candidate.value.value}`
}
}
}
// Handle arbitrary
if (candidate.kind === 'arbitrary') {
base += `[${candidate.property}:${printArbitraryValue(candidate.value)}]`
}
// Handle modifier
if (candidate.kind === 'arbitrary' || candidate.kind === 'functional') {
base += printModifier(candidate.modifier)
}
// Handle important
if (candidate.important) {
base += '!'
}
parts.push(base)
return parts.join(':')
}
Domain
Subdomains
Called By
- allVariablesAreUsed()
- arbitraryUtilities()
- arbitraryValueToBareValueUtility()
- bareValueUtilities()
- buildDesignSystem()
- createCanonicalizeCandidateCache()
- createCanonicalizeUtilityCache()
- dropUnnecessaryDataTypes()
- migrateArbitraryVariants()
- migrateAutomaticVarInjection()
- migrateCamelcaseInNamedValue()
- migrateLegacyArbitraryValues()
- migrateLegacyClasses()
- migrateModernizeArbitraryValues()
- migratePrefix()
- migrateVariantOrder()
- optimizeModifier()
- printUnprefixedCandidate()
- printUnprefixedCandidate()
Source
Frequently Asked Questions
What does printCandidate() do?
printCandidate() is a function in the tailwindcss codebase.
What does printCandidate() call?
printCandidate() calls 4 function(s): isVar, printArbitraryValue, printModifier, printVariant.
What calls printCandidate()?
printCandidate() is called by 19 function(s): allVariablesAreUsed, arbitraryUtilities, arbitraryValueToBareValueUtility, bareValueUtilities, buildDesignSystem, createCanonicalizeCandidateCache, createCanonicalizeUtilityCache, dropUnnecessaryDataTypes, and 11 more.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free