[]previous and next page

scriptsHtml

The markup of a list of scripts for the document head: the beforeInteractive ones first, then the afterInteractive ones, each source once, in the order given.

The markup of a list of scripts for the document head: the beforeInteractive ones first, then the afterInteractive ones, each source once, in the order given. lazyOnload scripts are left out.

Import#

ts
import { scriptsHtml } from "@shadow-js/dusk";

Signature#

ts
function scriptsHtml(scripts: readonly ScriptOptions[], nonce?: string): string

Parameters#

Name Description
scripts The scripts.
nonce The request's nonce, given to each.

Returns#

The markup.

Examples#

ts
import { scriptsHtml } from "@shadow-js/dusk";
scriptsHtml([{ src: "/late.js" }, { src: "/early.js", strategy: "beforeInteractive" }]);
// '<script src="/early.js"></script><script src="/late.js" async></script>'