Volt.Preload (Volt v0.10.1)

Copy Markdown View Source

Generate <link rel="modulepreload"> tags for production chunks.

When using code splitting, async chunks should be preloaded to avoid waterfall loading. This module generates the HTML tags from the build manifest.

Example

Volt.Preload.tags("priv/static/assets/js/manifest.json", prefix: "/assets/js")
#=> ~s(<link rel="modulepreload" href="/assets/js/app-a1b2c3d4.js">\n...)

Summary

Functions

Generate modulepreload link tags from a manifest file or map.

Functions

tags(manifest, opts \\ [])

@spec tags(
  String.t() | map(),
  keyword()
) :: String.t()

Generate modulepreload link tags from a manifest file or map.

Options

  • :prefix — URL prefix for assets (default: "/assets")
  • :entry — only preload chunks related to this entry name