Home / Function/ compoundsForSelectors() — tailwindcss Function Reference

compoundsForSelectors() — tailwindcss Function Reference

Architecture documentation for the compoundsForSelectors() function in variants.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  3a207375_0c4d_0a9e_f1f0_05b2b56ac8a7["compoundsForSelectors()"]
  3b6a2079_7f12_42cd_ba9f_a57ecec4366d["buildPluginApi()"]
  3b6a2079_7f12_42cd_ba9f_a57ecec4366d -->|calls| 3a207375_0c4d_0a9e_f1f0_05b2b56ac8a7
  95cb326e_6b59_0903_0c96_d221fca5c2b1["parseCss()"]
  95cb326e_6b59_0903_0c96_d221fca5c2b1 -->|calls| 3a207375_0c4d_0a9e_f1f0_05b2b56ac8a7
  24c6462c_8059_28e8_4bfc_8d04c9da1c7e["fromAst()"]
  24c6462c_8059_28e8_4bfc_8d04c9da1c7e -->|calls| 3a207375_0c4d_0a9e_f1f0_05b2b56ac8a7
  fd3adc32_3109_75f1_7942_d8cb145512d7["compoundsWith()"]
  fd3adc32_3109_75f1_7942_d8cb145512d7 -->|calls| 3a207375_0c4d_0a9e_f1f0_05b2b56ac8a7
  c067616f_e276_458d_2166_c9f10e6fcc93["createVariants()"]
  c067616f_e276_458d_2166_c9f10e6fcc93 -->|calls| 3a207375_0c4d_0a9e_f1f0_05b2b56ac8a7
  style 3a207375_0c4d_0a9e_f1f0_05b2b56ac8a7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tailwindcss/src/variants.ts lines 319–346

export function compoundsForSelectors(selectors: string[]) {
  let compounds = Compounds.Never

  for (let sel of selectors) {
    if (sel[0] === '@') {
      // Non-conditional at-rules are present so we can't compound
      if (
        !sel.startsWith('@media') &&
        !sel.startsWith('@supports') &&
        !sel.startsWith('@container')
      ) {
        return Compounds.Never
      }

      compounds |= Compounds.AtRules
      continue
    }

    // Pseudo-elements are present so we can't compound
    if (sel.includes('::')) {
      return Compounds.Never
    }

    compounds |= Compounds.StyleRules
  }

  return compounds
}

Domain

Subdomains

Frequently Asked Questions

What does compoundsForSelectors() do?
compoundsForSelectors() is a function in the tailwindcss codebase.
What calls compoundsForSelectors()?
compoundsForSelectors() is called by 5 function(s): buildPluginApi, compoundsWith, createVariants, fromAst, parseCss.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free