Home / Function/ relative() — tailwindcss Function Reference

relative() — tailwindcss Function Reference

Architecture documentation for the relative() function in renderer.ts from the tailwindcss codebase.

Entity Profile

Dependency Diagram

graph TD
  85696a99_698d_94e6_aa94_10c070d75965["relative()"]
  8d0812d4_61e4_e939_916d_a33e94faf43f["migrateJsConfig()"]
  8d0812d4_61e4_e939_916d_a33e94faf43f -->|calls| 85696a99_698d_94e6_aa94_10c070d75965
  32e1ecdd_6093_f556_114f_ec3d5663975f["migratePostCSSConfig()"]
  32e1ecdd_6093_f556_114f_ec3d5663975f -->|calls| 85696a99_698d_94e6_aa94_10c070d75965
  6a659766_1d3a_b133_2d7b_62f11f4e9450["analyze()"]
  6a659766_1d3a_b133_2d7b_62f11f4e9450 -->|calls| 85696a99_698d_94e6_aa94_10c070d75965
  cbddaa36_42d2_e648_576c_630798f80b7c["linkConfigs()"]
  cbddaa36_42d2_e648_576c_630798f80b7c -->|calls| 85696a99_698d_94e6_aa94_10c070d75965
  d1aa21a8_ad44_6ad5_f1e9_8c1f02bbff2d["prepareConfig()"]
  d1aa21a8_ad44_6ad5_f1e9_8c1f02bbff2d -->|calls| 85696a99_698d_94e6_aa94_10c070d75965
  95e0743f_e97d_47fd_9190_ebfac9416c13["detectConfigPath()"]
  95e0743f_e97d_47fd_9190_ebfac9416c13 -->|calls| 85696a99_698d_94e6_aa94_10c070d75965
  eb8ababf_fa35_08e1_76f8_c2b2cea868b8["run()"]
  eb8ababf_fa35_08e1_76f8_c2b2cea868b8 -->|calls| 85696a99_698d_94e6_aa94_10c070d75965
  style 85696a99_698d_94e6_aa94_10c070d75965 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/@tailwindcss-upgrade/src/utils/renderer.ts lines 23–38

export function relative(
  to: string,
  from = process.cwd(),
  { preferAbsoluteIfShorter = true } = {},
) {
  let result = path.relative(from, to)
  if (!result.startsWith('..')) {
    result = `.${path.sep}${result}`
  }

  if (preferAbsoluteIfShorter && result.length > to.length) {
    return to
  }

  return result
}

Domain

Subdomains

Frequently Asked Questions

What does relative() do?
relative() is a function in the tailwindcss codebase.
What calls relative()?
relative() is called by 7 function(s): analyze, detectConfigPath, linkConfigs, migrateJsConfig, migratePostCSSConfig, prepareConfig, run.

Analyze Your Own Codebase

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

Try Supermodel Free