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
  ed286c50_134b_5b5b_ff58_76456160010c["compoundsForSelectors()"]
  b638ddb2_c057_1f3c_8a1a_4993ad80cd58["variants.ts"]
  ed286c50_134b_5b5b_ff58_76456160010c -->|defined in| b638ddb2_c057_1f3c_8a1a_4993ad80cd58
  31653e23_464a_3652_4a48_0c82332a92c4["buildPluginApi()"]
  31653e23_464a_3652_4a48_0c82332a92c4 -->|calls| ed286c50_134b_5b5b_ff58_76456160010c
  f7f9b3da_5977_1aa6_3bcb_bfc607af4e8f["parseCss()"]
  f7f9b3da_5977_1aa6_3bcb_bfc607af4e8f -->|calls| ed286c50_134b_5b5b_ff58_76456160010c
  63907b21_884d_e864_81c9_68f20a13c40b["fromAst()"]
  63907b21_884d_e864_81c9_68f20a13c40b -->|calls| ed286c50_134b_5b5b_ff58_76456160010c
  f5fdf8c5_9ef2_b78b_1247_5ede58487336["compoundsWith()"]
  f5fdf8c5_9ef2_b78b_1247_5ede58487336 -->|calls| ed286c50_134b_5b5b_ff58_76456160010c
  876035d0_94a8_cf2f_314a_d520aaae6e4b["createVariants()"]
  876035d0_94a8_cf2f_314a_d520aaae6e4b -->|calls| ed286c50_134b_5b5b_ff58_76456160010c
  style ed286c50_134b_5b5b_ff58_76456160010c 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