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
  505fd744_81c1_a3d8_bae0_2cbba00f74d3["detectConfigPath()"]
  9dd8f849_c8e1_2210_efce_8cd2e70a472c["linkConfigs()"]
  9dd8f849_c8e1_2210_efce_8cd2e70a472c -->|calls| 505fd744_81c1_a3d8_bae0_2cbba00f74d3
  ac975fa0_6dfb_5b95_d79d_ea10cebf80a5["prepareConfig()"]
  ac975fa0_6dfb_5b95_d79d_ea10cebf80a5 -->|calls| 505fd744_81c1_a3d8_bae0_2cbba00f74d3
  df7fe510_fe45_e2c0_c3ca_4388536da642["parentPaths()"]
  505fd744_81c1_a3d8_bae0_2cbba00f74d3 -->|calls| df7fe510_fe45_e2c0_c3ca_4388536da642
  f0667321_097b_1dca_a21c_a0c318a6236a["highlight()"]
  505fd744_81c1_a3d8_bae0_2cbba00f74d3 -->|calls| f0667321_097b_1dca_a21c_a0c318a6236a
  a4d70660_306b_669c_4b1c_828588c6371c["relative()"]
  505fd744_81c1_a3d8_bae0_2cbba00f74d3 -->|calls| a4d70660_306b_669c_4b1c_828588c6371c
  style 505fd744_81c1_a3d8_bae0_2cbba00f74d3 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.
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