printCandidate() — tailwindcss Function Reference
Architecture documentation for the printCandidate() function in candidate.ts from the tailwindcss codebase.
Entity Profile
Dependency Diagram
graph TD 2de86ba2_90a4_8c2d_db18_154bb1a1564f["printCandidate()"] ba6fca27_7720_5839_0f92_bc2abb8db636["candidate.ts"] 2de86ba2_90a4_8c2d_db18_154bb1a1564f -->|defined in| ba6fca27_7720_5839_0f92_bc2abb8db636 7b5f0bd4_23ae_bb4e_d530_89422e2e7c4b["printUnprefixedCandidate()"] 7b5f0bd4_23ae_bb4e_d530_89422e2e7c4b -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f 7a380dd4_2f8e_5aa7_b4ee_bf219cb7807f["migrateArbitraryVariants()"] 7a380dd4_2f8e_5aa7_b4ee_bf219cb7807f -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f d9972d7e_4ead_d84f_3f97_3cc5f06273b9["migrateAutomaticVarInjection()"] d9972d7e_4ead_d84f_3f97_3cc5f06273b9 -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f e33960a2_fa25_720d_6e49_e29c569295d2["migrateCamelcaseInNamedValue()"] e33960a2_fa25_720d_6e49_e29c569295d2 -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f a8ebd8e1_4e38_4a06_28e7_e26261806723["migrateLegacyArbitraryValues()"] a8ebd8e1_4e38_4a06_28e7_e26261806723 -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f e23cd15e_fdc1_d590_bce2_3d2a9c41fd9f["migrateLegacyClasses()"] e23cd15e_fdc1_d590_bce2_3d2a9c41fd9f -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f 95e8edc9_45de_ca00_e4d2_601d3ae22f9f["migrateModernizeArbitraryValues()"] 95e8edc9_45de_ca00_e4d2_601d3ae22f9f -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f 7a457be5_eaef_02ce_7bc4_4e0317ecd8ce["migratePrefix()"] 7a457be5_eaef_02ce_7bc4_4e0317ecd8ce -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f d6f03aba_eecb_9486_a7b9_25fc0f87915d["migrateVariantOrder()"] d6f03aba_eecb_9486_a7b9_25fc0f87915d -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f 8678786b_ce4d_e620_10b5_0449d39487fc["createCanonicalizeCandidateCache()"] 8678786b_ce4d_e620_10b5_0449d39487fc -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f 760a1feb_30f8_c4b2_c08b_eab7c29d415e["createCanonicalizeUtilityCache()"] 760a1feb_30f8_c4b2_c08b_eab7c29d415e -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f b12efe90_482b_52b8_1913_f2eb419a12f7["printUnprefixedCandidate()"] b12efe90_482b_52b8_1913_f2eb419a12f7 -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f 59459a7a_2e6a_375a_d02d_f7a77927b468["arbitraryUtilities()"] 59459a7a_2e6a_375a_d02d_f7a77927b468 -->|calls| 2de86ba2_90a4_8c2d_db18_154bb1a1564f style 2de86ba2_90a4_8c2d_db18_154bb1a1564f 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
Defined In
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, defined in packages/tailwindcss/src/candidate.ts.
Where is printCandidate() defined?
printCandidate() is defined in packages/tailwindcss/src/candidate.ts at line 907.
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