Home / Function/ toAssetPathFromHtml() — vite Function Reference

toAssetPathFromHtml() — vite Function Reference

Architecture documentation for the toAssetPathFromHtml() function in index.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  e4d2379b_4e77_cb47_c192_09b680b7570b["toAssetPathFromHtml()"]
  9776ecb6_00c0_b3b9_b3f7_177fedabeacc["index.ts"]
  e4d2379b_4e77_cb47_c192_09b680b7570b -->|defined in| 9776ecb6_00c0_b3b9_b3f7_177fedabeacc
  cf21e8d8_cce6_30a7_7732_696ed5cdf103["viteLegacyPlugin()"]
  cf21e8d8_cce6_30a7_7732_696ed5cdf103 -->|calls| e4d2379b_4e77_cb47_c192_09b680b7570b
  3eaba61a_f505_5a6d_7f8c_88d6ad3815c2["getBaseInHTML()"]
  e4d2379b_4e77_cb47_c192_09b680b7570b -->|calls| 3eaba61a_f505_5a6d_7f8c_88d6ad3815c2
  93378aa0_5b0f_e84a_a1cf_4da651efbca1["toOutputFilePathInHtml()"]
  e4d2379b_4e77_cb47_c192_09b680b7570b -->|calls| 93378aa0_5b0f_e84a_a1cf_4da651efbca1
  style e4d2379b_4e77_cb47_c192_09b680b7570b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/plugin-legacy/src/index.ts lines 102–118

function toAssetPathFromHtml(
  filename: string,
  htmlPath: string,
  config: ResolvedConfig,
): string {
  const relativeUrlPath = normalizePath(path.relative(config.root, htmlPath))
  const toRelative = (filename: string, _hostId: string) =>
    getBaseInHTML(relativeUrlPath, config) + filename
  return toOutputFilePathInHtml(
    filename,
    'asset',
    htmlPath,
    'html',
    config,
    toRelative,
  )
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does toAssetPathFromHtml() do?
toAssetPathFromHtml() is a function in the vite codebase, defined in packages/plugin-legacy/src/index.ts.
Where is toAssetPathFromHtml() defined?
toAssetPathFromHtml() is defined in packages/plugin-legacy/src/index.ts at line 102.
What does toAssetPathFromHtml() call?
toAssetPathFromHtml() calls 2 function(s): getBaseInHTML, toOutputFilePathInHtml.
What calls toAssetPathFromHtml()?
toAssetPathFromHtml() is called by 1 function(s): viteLegacyPlugin.

Analyze Your Own Codebase

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

Try Supermodel Free