Watch Mode & Clipboard
Starting a variation watch
pnpm start 0 # watches v1
pnpm start 1 # watches v2
pnpm start 2 # watches v3The numeric argument is zero-indexed: 0 targets src/js/v1/index.jsx, 1 targets src/js/v2/index.jsx, and so on.
Internally, pnpm start 0 runs:
node scripts/build.js --watch -e0The -e0 flag tells the build script to focus on variation 1 and enable clipboard copy on each successful rebuild.
Clipboard copy
On every save, the IIFE bundle is automatically copied to your clipboard:
| OS | Tool used |
|---|---|
| macOS | pbcopy (built-in) |
| Linux | xclip -selection clipboard |
| Windows | clip (built-in) |
If the clipboard tool is unavailable, the build continues silently — you'll just need to copy the bundle manually from dist/v1/v1.js.
Linux: install xclip
# Ubuntu / Debian
sudo apt-get install xclip
# Arch
sudo pacman -S xclipPasting into Adobe Target
- Open your Adobe Target activity and navigate to the custom code editor for the variation you're developing.
- Switch to your terminal — the clipboard already contains the latest bundle.
- Select all existing content in the code editor and paste.
- Click Save in Adobe Target and refresh your preview page.
How the bundle works
The IIFE bundle registers itself under window.sgd (or your chosen namespace). Adobe Target's custom code editor accepts raw JavaScript — no module loader is required.
Watching all variations
To rebuild all variations on every save without clipboard copy:
pnpm devUse pnpm dev when you want to verify that all variations build cleanly. Use pnpm start N when actively iterating on a single variation.