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
  efdaf4fe_1cde_66e0_60e0_5e155e297f6d["relative()"]
  9106c15d_cfb8_77f5_665e_9707020b48c8["renderer.ts"]
  efdaf4fe_1cde_66e0_60e0_5e155e297f6d -->|defined in| 9106c15d_cfb8_77f5_665e_9707020b48c8
  1ef01211_e07d_fbec_dcb1_d3c7a3bfe061["migrateJsConfig()"]
  1ef01211_e07d_fbec_dcb1_d3c7a3bfe061 -->|calls| efdaf4fe_1cde_66e0_60e0_5e155e297f6d
  18049d5a_3e65_d6cd_49d2_32e825145fa2["migratePostCSSConfig()"]
  18049d5a_3e65_d6cd_49d2_32e825145fa2 -->|calls| efdaf4fe_1cde_66e0_60e0_5e155e297f6d
  60cad534_12fe_6e72_4bc7_443aad14536b["analyze()"]
  60cad534_12fe_6e72_4bc7_443aad14536b -->|calls| efdaf4fe_1cde_66e0_60e0_5e155e297f6d
  d2577f0e_a6a7_a7ce_6228_851bc0240e63["linkConfigs()"]
  d2577f0e_a6a7_a7ce_6228_851bc0240e63 -->|calls| efdaf4fe_1cde_66e0_60e0_5e155e297f6d
  9faa4462_1a05_6046_b23a_09ba561cb528["prepareConfig()"]
  9faa4462_1a05_6046_b23a_09ba561cb528 -->|calls| efdaf4fe_1cde_66e0_60e0_5e155e297f6d
  29edd669_83d1_d2aa_eab9_7e8139fc8b20["detectConfigPath()"]
  29edd669_83d1_d2aa_eab9_7e8139fc8b20 -->|calls| efdaf4fe_1cde_66e0_60e0_5e155e297f6d
  6066f111_c660_b87d_6993_07d8cc779b5c["run()"]
  6066f111_c660_b87d_6993_07d8cc779b5c -->|calls| efdaf4fe_1cde_66e0_60e0_5e155e297f6d
  style efdaf4fe_1cde_66e0_60e0_5e155e297f6d 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