Function

asset

From mothwing ยท src/asset.js:39

A file for the build, made from data: a search index, a feed, a generated image. The build writes it, and a page links to it by this value, its URL with a hash of the content, like the JS and CSS links: <input data-index="{{ search.index }}"> -> data-index="/search.json?v=1a2b3c4d". The hash only changes when the content does, so browsers and CDNs can keep it until then.

asset(
  file: string,
  content: string | Uint8Array<ArrayBufferLike>
): Asset

Parameters

filestringWhere it goes in the build: "search.json"
contentstring | Uint8Array<ArrayBufferLike>

Returns

Asset