#!/bin/zsh # Screenshot helper for the CSS polish pass. $1 = output dir (before|after) # Narrow widths go through dist/__probe.html (a fixed-width iframe): headless # Chrome clamps --window-size below ~500px, so 360/390/480 shots would silently # be 500px-wide renders cropped to the window. set -e CH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" ROOT="$(cd "$(dirname "$0")/../.." && pwd)" OUT="$(cd "$(dirname "$0")" && pwd)/$1" mkdir -p "$OUT" cp "$(dirname "$0")/__probe.html" "$ROOT/dist/__probe.html" shot() { # name url w h "$CH" --headless=new --disable-gpu --hide-scrollbars --window-size=$3,$4 \ --screenshot="$OUT/$1.png" "$2" >/dev/null 2>&1 } wide() { shot "$1" "http://localhost:4330$2" $3 $4; } # name path w h narrow() { # name path w h (h = iframe height) shot "$1" "http://localhost:4330/__probe.html?w=$3&h=$4&p=$2" $(($3 + 20)) $(($4 + 10)) } W='/news/ctao-and-cabildo-of-la-palma-organise-women-of-ctao-2026' wide home "/" 1440 2600 narrow home-390 "/" 390 2200 wide news "/news" 1440 2600 narrow news-390 "/news" 390 2400 wide news-768 "/news" 768 2200 wide art6 "/news/6" 1440 2600 narrow art6-390 "/news/6" 390 2600 wide artwomen "$W" 1440 2600 narrow artwomen-390 "$W" 390 2600 wide artwomen-1280 "$W" 1280 2000 wide search "/search?q=lst" 1440 2000 narrow search-390 "/search?q=lst" 390 1800 wide support "/support" 1440 1800 narrow support-360 "/support" 360 1500 wide privacy "/pages/privacy" 1440 1400 narrow privacy-390 "/pages/privacy" 390 1500 wide nf "/404-nonexistent" 1440 1200 narrow nf-390 "/404-nonexistent" 390 1300 wide proposals "/proposals" 1440 1600 narrow proposals-390 "/proposals" 390 1700 wide dashboard "/dashboard" 1440 1600 narrow dashboard-480 "/dashboard" 480 1900 wide login "/login" 1440 1200 narrow login-390 "/login" 390 1100 echo "shots in $OUT"