Already using Heroshot with Docusaurus? Here's what else it can do.
Responsive screenshots
Need desktop and mobile versions? Add viewports to your config:
{
"name": "dashboard",
"url": "http://localhost:3000/dashboard",
"selector": ".main-content",
"viewports": ["desktop", "mobile"]
}
One config entry, four screenshots: desktop-light, desktop-dark, mobile-light, mobile-dark.
The component handles srcset automatically:
<Heroshot name="dashboard" alt="Dashboard" />
Readers get the right size for their device.
Retina support
For crisp screenshots on high-DPI displays:
{
"name": "dashboard",
"url": "http://localhost:3000/dashboard",
"deviceScaleFactor": 2
}
Captures at 2x resolution. The component serves them properly scaled.
CI/CD automation
Screenshots can regenerate on every deploy. Add to your GitHub Action:
- name: Update screenshots
run: npx heroshot --headless
- name: Commit if changed
run: |
git diff --quiet static/heroshots/ || \
(git add static/heroshots/ && git commit -m "Update screenshots")
Or schedule weekly updates:
on:
schedule:
- cron: '0 0 * * 0'
No more stale screenshots.
Theme detection
The component watches <html data-theme="dark"> for changes. When users toggle Docusaurus's theme, screenshots swap instantly. No page reload, no flash.
This works because heroshot renders a <picture> element with media queries:
<picture>
<source srcset="dashboard-dark.png" media="(prefers-color-scheme: dark)" />
<source srcset="dashboard-dark.png" media="[data-theme=dark]" />
<img src="dashboard-light.png" alt="Dashboard" />
</picture>
One-off captures
Need a quick screenshot without touching config?
npx heroshot https://your-app.com --dark --light --mobile
Three flags, six files. Done.
New to Heroshot? Start with the setup guide.
Full docs: heroshot.sh/docs/integrations/docusaurus
Top comments (0)