Skip to content

snapshot

snapshot(config): AstroIntegration

Defined in: index.ts:83

Creates an Astro integration that captures screenshots of specified pages during the astro:build:done lifecycle event.

Config

Integration configuration, including page mappings, defaults, and Puppeteer settings.

AstroIntegration

The configured Astro integration.

// Capture the home page and an about page with shared defaults
snapshot({
  pages: {
    '/': [{ outputPath: 'src/assets/home-og.png' }],
    '/about': [{ outputPath: 'src/assets/about-og.png' }],
  },
  defaults: {
    width: 1200,
    height: 630,
    overwrite: true,
  },
});
// Capture multiple screenshots of the same page at different sizes
snapshot({
  pages: {
    '/': [
      { outputPath: 'src/assets/og.png', width: 1200, height: 630 },
      { outputPath: 'src/assets/square.png', width: 512, height: 512 },
    ],
  },
});