Home / Function/ renderPreloadLinks() — vue Function Reference

renderPreloadLinks() — vue Function Reference

Architecture documentation for the renderPreloadLinks() function in index.ts from the vue codebase.

Entity Profile

Dependency Diagram

graph TD
  c1d72880_cec6_6002_08a1_266f22372755["renderPreloadLinks()"]
  7f02213e_fb34_2058_966a_5fea6f3a95d9["renderResourceHints()"]
  7f02213e_fb34_2058_966a_5fea6f3a95d9 -->|calls| c1d72880_cec6_6002_08a1_266f22372755
  74f28fcc_fe46_9ea6_9dc9_933f373dff63["getPreloadFiles()"]
  c1d72880_cec6_6002_08a1_266f22372755 -->|calls| 74f28fcc_fe46_9ea6_9dc9_933f373dff63
  style c1d72880_cec6_6002_08a1_266f22372755 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/server-renderer/src/template-renderer/index.ts lines 176–202

  renderPreloadLinks(context: Object): string {
    const files = this.getPreloadFiles(context)
    const shouldPreload = this.options.shouldPreload
    if (files.length) {
      return files
        .map(({ file, extension, fileWithoutQuery, asType }) => {
          let extra = ''
          // by default, we only preload scripts or css
          if (!shouldPreload && asType !== 'script' && asType !== 'style') {
            return ''
          }
          // user wants to explicitly control what to preload
          if (shouldPreload && !shouldPreload(fileWithoutQuery, asType)) {
            return ''
          }
          if (asType === 'font') {
            extra = ` type="font/${extension}" crossorigin`
          }
          return `<link rel="preload" href="${this.publicPath}${file}"${
            asType !== '' ? ` as="${asType}"` : ''
          }${extra}>`
        })
        .join('')
    } else {
      return ''
    }
  }

Subdomains

Frequently Asked Questions

What does renderPreloadLinks() do?
renderPreloadLinks() is a function in the vue codebase.
What does renderPreloadLinks() call?
renderPreloadLinks() calls 1 function(s): getPreloadFiles.
What calls renderPreloadLinks()?
renderPreloadLinks() is called by 1 function(s): renderResourceHints.

Analyze Your Own Codebase

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

Try Supermodel Free