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
  c77d7f70_19ea_6ee5_b5a1_f39fc8c5b2c1["renderPreloadLinks()"]
  a6b6f41b_6598_1b32_00b3_8bbaa08b8c64["TemplateRenderer"]
  c77d7f70_19ea_6ee5_b5a1_f39fc8c5b2c1 -->|defined in| a6b6f41b_6598_1b32_00b3_8bbaa08b8c64
  1e33fa19_964c_fc1d_b475_9148bf079077["renderResourceHints()"]
  1e33fa19_964c_fc1d_b475_9148bf079077 -->|calls| c77d7f70_19ea_6ee5_b5a1_f39fc8c5b2c1
  c5a33546_28a8_ada6_eaf0_9eccdf8cec76["getPreloadFiles()"]
  c77d7f70_19ea_6ee5_b5a1_f39fc8c5b2c1 -->|calls| c5a33546_28a8_ada6_eaf0_9eccdf8cec76
  style c77d7f70_19ea_6ee5_b5a1_f39fc8c5b2c1 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, defined in packages/server-renderer/src/template-renderer/index.ts.
Where is renderPreloadLinks() defined?
renderPreloadLinks() is defined in packages/server-renderer/src/template-renderer/index.ts at line 176.
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