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
  af4df363_0f48_b01c_23c9_2fbbbb45c164["detectConfigPath()"]
  d58c78f4_5856_72aa_9dca_c418a7d7f31e["prepare-config.ts"]
  af4df363_0f48_b01c_23c9_2fbbbb45c164 -->|defined in| d58c78f4_5856_72aa_9dca_c418a7d7f31e
  4f9fee38_d67e_7a5e_2399_4ea7bba30391["linkConfigs()"]
  4f9fee38_d67e_7a5e_2399_4ea7bba30391 -->|calls| af4df363_0f48_b01c_23c9_2fbbbb45c164
  3dec545a_c324_15f0_cdd3_7c9a86137145["prepareConfig()"]
  3dec545a_c324_15f0_cdd3_7c9a86137145 -->|calls| af4df363_0f48_b01c_23c9_2fbbbb45c164
  374e938a_ee2f_054d_3f92_965e3288c0f8["parentPaths()"]
  af4df363_0f48_b01c_23c9_2fbbbb45c164 -->|calls| 374e938a_ee2f_054d_3f92_965e3288c0f8
  d3ccc5ce_e370_63df_a97d_a2f004fd83ca["highlight()"]
  af4df363_0f48_b01c_23c9_2fbbbb45c164 -->|calls| d3ccc5ce_e370_63df_a97d_a2f004fd83ca
  1c806fef_a933_285c_65d9_c10998b12c7d["relative()"]
  af4df363_0f48_b01c_23c9_2fbbbb45c164 -->|calls| 1c806fef_a933_285c_65d9_c10998b12c7d
  style af4df363_0f48_b01c_23c9_2fbbbb45c164 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