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
  759ab8d0_0e80_5789_e945_a5f814874e59["compoundsForSelectors()"]
  db9eae47_695c_23c3_68bd_bae5bb363efe["variants.ts"]
  759ab8d0_0e80_5789_e945_a5f814874e59 -->|defined in| db9eae47_695c_23c3_68bd_bae5bb363efe
  2efa0a66_c375_c031_24ad_1f7509bb9b14["buildPluginApi()"]
  2efa0a66_c375_c031_24ad_1f7509bb9b14 -->|calls| 759ab8d0_0e80_5789_e945_a5f814874e59
  3970218d_3d6c_e455_87cc_45b4a094f0e9["parseCss()"]
  3970218d_3d6c_e455_87cc_45b4a094f0e9 -->|calls| 759ab8d0_0e80_5789_e945_a5f814874e59
  34338b14_fec6_6308_0fd7_15af8d4da01b["fromAst()"]
  34338b14_fec6_6308_0fd7_15af8d4da01b -->|calls| 759ab8d0_0e80_5789_e945_a5f814874e59
  b1efac17_4504_4725_555d_d07e8cf1a9ea["compoundsWith()"]
  b1efac17_4504_4725_555d_d07e8cf1a9ea -->|calls| 759ab8d0_0e80_5789_e945_a5f814874e59
  c1a769fc_95ca_ceea_62f9_aedeeedf7c66["createVariants()"]
  c1a769fc_95ca_ceea_62f9_aedeeedf7c66 -->|calls| 759ab8d0_0e80_5789_e945_a5f814874e59
  style 759ab8d0_0e80_5789_e945_a5f814874e59 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, defined in packages/tailwindcss/src/variants.ts.
Where is compoundsForSelectors() defined?
compoundsForSelectors() is defined in packages/tailwindcss/src/variants.ts at line 319.
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