Skip to content
📤

Astro Emit Asset

Emit static assets from Astro components and endpoints

Call a function…

const asset = await emitAsset(
'my.gif',
[],
() => generateImage()
);

…get the URL for your asset.

<img src={asset.src}>
Generated 88x31 pixel badge with the text 'my.gif' and a framed picture emoji

astro-emit-asset is an Astro integration that makes it possible to create files in the build output of a site as a “side effect” of pages, endpoints, and other code. Use it for open graph images, generated PDFs, audio files, or anything else you need.


Built for static sites

Designed to emit build-time assets for simple static hosting.

Automatic caching

Assets are cached across builds and only regenerated when their inputs change.

Full build compatibility

Emit assets from Markdown plugins, components, pages, static endpoints, or any other part of your build pipeline.

Integration ready

Use in your Astro integration to manage assets you need to create.