#! /usr/bin/env bash cd "$(dirname "$0")" name="$(basename "$(pwd)")" t="$(mktemp --suffix=.pdf)" if ! typst compile --root .. ./main.typ "$t"; then echo "Failed to compile $name/main.typ. Please fix errors and run me again." exit 1 fi echo "Initial compilation successful. Now starting watch mode. Opening $t" xdg-open "$t" typst watch --root .. ./main.typ "$t"