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
  084c1c04_6820_3348_0fdd_57af3695f448["renderPreloadLinks()"]
  d9b4566f_74ea_db87_d004_22dccd0797b4["renderResourceHints()"]
  d9b4566f_74ea_db87_d004_22dccd0797b4 -->|calls| 084c1c04_6820_3348_0fdd_57af3695f448
  1ee75beb_2eda_5ae5_3fad_1ab556403321["getPreloadFiles()"]
  084c1c04_6820_3348_0fdd_57af3695f448 -->|calls| 1ee75beb_2eda_5ae5_3fad_1ab556403321
  style 084c1c04_6820_3348_0fdd_57af3695f448 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