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
  1c806fef_a933_285c_65d9_c10998b12c7d["relative()"]
  2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277["renderer.ts"]
  1c806fef_a933_285c_65d9_c10998b12c7d -->|defined in| 2329d36e_5aa2_4fa5_cf9f_a9c6cc4e1277
  617e9831_5cd2_4ca6_2c65_f89e3720cfd8["migrateJsConfig()"]
  617e9831_5cd2_4ca6_2c65_f89e3720cfd8 -->|calls| 1c806fef_a933_285c_65d9_c10998b12c7d
  0cb85618_1b33_b9dc_ae2b_1bc3e6bd6069["migratePostCSSConfig()"]
  0cb85618_1b33_b9dc_ae2b_1bc3e6bd6069 -->|calls| 1c806fef_a933_285c_65d9_c10998b12c7d
  6d7d3a7a_08dc_88e4_0b4a_9f563d66e582["analyze()"]
  6d7d3a7a_08dc_88e4_0b4a_9f563d66e582 -->|calls| 1c806fef_a933_285c_65d9_c10998b12c7d
  4f9fee38_d67e_7a5e_2399_4ea7bba30391["linkConfigs()"]
  4f9fee38_d67e_7a5e_2399_4ea7bba30391 -->|calls| 1c806fef_a933_285c_65d9_c10998b12c7d
  3dec545a_c324_15f0_cdd3_7c9a86137145["prepareConfig()"]
  3dec545a_c324_15f0_cdd3_7c9a86137145 -->|calls| 1c806fef_a933_285c_65d9_c10998b12c7d
  af4df363_0f48_b01c_23c9_2fbbbb45c164["detectConfigPath()"]
  af4df363_0f48_b01c_23c9_2fbbbb45c164 -->|calls| 1c806fef_a933_285c_65d9_c10998b12c7d
  817bb61a_7ad0_1186_790a_6a40126eed80["run()"]
  817bb61a_7ad0_1186_790a_6a40126eed80 -->|calls| 1c806fef_a933_285c_65d9_c10998b12c7d
  style 1c806fef_a933_285c_65d9_c10998b12c7d 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
}

Subdomains

Frequently Asked Questions

What does relative() do?
relative() is a function in the tailwindcss codebase, defined in packages/@tailwindcss-upgrade/src/utils/renderer.ts.
Where is relative() defined?
relative() is defined in packages/@tailwindcss-upgrade/src/utils/renderer.ts at line 23.
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