Skip to content

AssetSpec

ts
type AssetSpec: object;

Per-asset specifications assigned by the user.

Type declaration

class?

ts
optional class: string;

When specified, adds specified class attribute to generated HTML container.

eager?

ts
optional eager: boolean;

When set to true the asset will be loaded eagerly (instead of default lazy). Use for above the fold content, ie initially visible w/o scrolling, such as hero image.

media?

ts
optional media: string;

Media attribute to specify for applicable source tag. Can be used with the "merge" spec for art direction. Example below will show "wide.png" when window width is 800px or more and switch to "narrow.png" when the window width is equal to or below 799px.

Example

md
 ![?media=(min-width:800px)](/wide.png)
 ![?media=(max-width:799px)&merge](/narrow.png)

merge?

ts
optional merge: boolean;

When set to true syntax will be merged with the previous one in the document. Can be used to specify multiple sources with different specs for a single asset.

width?

ts
optional width: number;

Width threshold for the asset content, in pixels. Overrides global width parameter.

Source

server/asset.ts:37 ↗