Home / Function/ detectConfigPath() — tailwindcss Function Reference

detectConfigPath() — tailwindcss Function Reference

Architecture documentation for the detectConfigPath() function in prepare-config.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  29edd669_83d1_d2aa_eab9_7e8139fc8b20["detectConfigPath()"]
  c8809718_3b35_1fdb_ff99_94e375c7360a["prepare-config.ts"]
  29edd669_83d1_d2aa_eab9_7e8139fc8b20 -->|defined in| c8809718_3b35_1fdb_ff99_94e375c7360a
  d2577f0e_a6a7_a7ce_6228_851bc0240e63["linkConfigs()"]
  d2577f0e_a6a7_a7ce_6228_851bc0240e63 -->|calls| 29edd669_83d1_d2aa_eab9_7e8139fc8b20
  9faa4462_1a05_6046_b23a_09ba561cb528["prepareConfig()"]
  9faa4462_1a05_6046_b23a_09ba561cb528 -->|calls| 29edd669_83d1_d2aa_eab9_7e8139fc8b20
  83deb7ef_c650_3d7d_4886_a0ff88211528["parentPaths()"]
  29edd669_83d1_d2aa_eab9_7e8139fc8b20 -->|calls| 83deb7ef_c650_3d7d_4886_a0ff88211528
  a81de696_6bb5_40db_26ca_1d707ccebed9["highlight()"]
  29edd669_83d1_d2aa_eab9_7e8139fc8b20 -->|calls| a81de696_6bb5_40db_26ca_1d707ccebed9
  efdaf4fe_1cde_66e0_60e0_5e155e297f6d["relative()"]
  29edd669_83d1_d2aa_eab9_7e8139fc8b20 -->|calls| efdaf4fe_1cde_66e0_60e0_5e155e297f6d
  style 29edd669_83d1_d2aa_eab9_7e8139fc8b20 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-upgrade/src/codemods/template/prepare-config.ts lines 97–111

export async function detectConfigPath(start: string, end: string = start) {
  for (let base of parentPaths(start, end)) {
    for (let file of DEFAULT_CONFIG_FILES) {
      let fullPath = path.resolve(base, file)
      try {
        await fs.access(fullPath)
        return fullPath
      } catch {}
    }
  }

  throw new Error(
    `No configuration file found for ${highlight(relative(start))}. Please provide a path to the Tailwind CSS v3 config file via the ${highlight('--config')} option.`,
  )
}

Subdomains

Frequently Asked Questions

What does detectConfigPath() do?
detectConfigPath() is a function in the tailwindcss codebase, defined in packages/@tailwindcss-upgrade/src/codemods/template/prepare-config.ts.
Where is detectConfigPath() defined?
detectConfigPath() is defined in packages/@tailwindcss-upgrade/src/codemods/template/prepare-config.ts at line 97.
What does detectConfigPath() call?
detectConfigPath() calls 3 function(s): highlight, parentPaths, relative.
What calls detectConfigPath()?
detectConfigPath() is called by 2 function(s): linkConfigs, prepareConfig.

Analyze Your Own Codebase

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

Try Supermodel Free