stencila snap
snap
Iterate on themes and styled elements and verify changes - Capture screenshots for documentation or CI - Assert computed CSS properties and layout metrics - Measure page elements for automated testing
Usage
stencila snap [OPTIONS] [PATH] [OUTPUT]Examples
# Start server in background
stencila serve --sync in &
# Capture viewport screenshot (default)
stencila snap snaps/viewport.png
# Capture full scrollable page
stencila snap --full snaps/full.png
# Verify computed padding for title
stencila snap --assert "css([slot=title]).paddingTop>=24px"
# Capture mobile viewport of specific element
stencila snap --device mobile --selector "stencila-article [slot=title]" snaps/mobile.png
# Capture full mobile page
stencila snap --device mobile --full snaps/mobile-full.png
# Force light or dark mode
stencila snap --light snaps/light.png
stencila snap --dark snaps/dark.png
# Preview with PDF/print styles (A4 width)
stencila snap --print snaps/print-preview.png
# Multiple assertions without screenshot
stencila snap \
--assert "css([slot=title]).fontSize>=28px" \
--assert "count(section)==5" \
--measure
# Use custom viewport and wait conditions
stencila snap \
--width 1920 --height 1080 \
--wait-until networkidle \
--delay 500 \
snaps/desktop.png
# Capture specific document path
stencila snap docs/guide.md snaps/guide.pngArguments
[PATH] | |
[OUTPUT] |
Options
--selector | |
--full | truefalse |
--device | |
--width | |
--height | |
--dpr | |
--light | truefalse |
--dark | truefalse |
--print | truefalse |
--wait-until | network-idle |
--wait-for | |
--delay | |
--measure | truefalse |
--assert | |
--url |
--device
laptop | |
desktop | |
mobile | |
tablet | |
tablet-landscape |
--wait-until
load | |
dom-content-loaded | |
network-idle |