Skip to content

Instantly share code, notes, and snippets.

@maxfenton
Created May 7, 2026 14:01
Show Gist options
  • Select an option

  • Save maxfenton/216de8bc827fc141aaf9c04f6529cfa0 to your computer and use it in GitHub Desktop.

Select an option

Save maxfenton/216de8bc827fc141aaf9c04f6529cfa0 to your computer and use it in GitHub Desktop.
bin/backstop
#!/usr/bin/env bash
# Wrapper around the global `backstop` CLI.
#
# Usage:
# bin/backstop reference # capture from production (default)
# bin/backstop test --env=local # test against local DDEV site
# bin/backstop reference --env=staging
# bin/backstop approve
#
# --env=<local|staging|production> Sets BACKSTOP_ENV, read by backstop.cjs to pick baseUrl.
# Defaults to production.
ENV="production"
ARGS=()
for arg in "$@"; do
case "$arg" in
--env=*) ENV="${arg#*=}" ;;
*) ARGS+=("$arg") ;;
esac
done
BACKSTOP_ENV="$ENV" backstop "${ARGS[@]}" --config=backstop.cjs 2>&1 | grep -Ev 'BackstopTools have been installed'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment