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
  95e0743f_e97d_47fd_9190_ebfac9416c13["detectConfigPath()"]
  cbddaa36_42d2_e648_576c_630798f80b7c["linkConfigs()"]
  cbddaa36_42d2_e648_576c_630798f80b7c -->|calls| 95e0743f_e97d_47fd_9190_ebfac9416c13
  d1aa21a8_ad44_6ad5_f1e9_8c1f02bbff2d["prepareConfig()"]
  d1aa21a8_ad44_6ad5_f1e9_8c1f02bbff2d -->|calls| 95e0743f_e97d_47fd_9190_ebfac9416c13
  1f2a8419_11da_2210_8ef2_25558284b78f["parentPaths()"]
  95e0743f_e97d_47fd_9190_ebfac9416c13 -->|calls| 1f2a8419_11da_2210_8ef2_25558284b78f
  c1e4d14f_eec6_482b_9f78_0242ee9d41b8["highlight()"]
  95e0743f_e97d_47fd_9190_ebfac9416c13 -->|calls| c1e4d14f_eec6_482b_9f78_0242ee9d41b8
  85696a99_698d_94e6_aa94_10c070d75965["relative()"]
  95e0743f_e97d_47fd_9190_ebfac9416c13 -->|calls| 85696a99_698d_94e6_aa94_10c070d75965
  style 95e0743f_e97d_47fd_9190_ebfac9416c13 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.`,
  )
}

Domain

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