I’m evaluating this great-sounding project, and while some of my colleagues will love the web app, I and a few programmers are dedicated terminal junkies. I recall that there was a workflow where you’d type your Typst document in your text editor, and it would live update in your browser whenever you save. I assume it used inotify
on Linux and something else on MacOS, but also, what does one run in the browser to get an auto page-refresh? What’s the cleanest way of achieving this?
Hello @Vegabook,
if you wish to watch the document, then typst watch
is your friend. Instant updates would require your text editor to be configured with near-instant save after write. In neovim, that’s the autowriteall
option.
❯ typst watch -h
Watches an input file and recompiles on changes
Usage: typst watch [OPTIONS] <INPUT> [OUTPUT]
Arguments:`autowriteall`
<INPUT> Path to input Typst file. Use `-` to read input from stdin
[OUTPUT] Path to output file (PDF, PNG, SVG, or HTML). Use `-` to write
output to stdout
1 Like
I had this in a makefile for a bigger project recently, requires the tinymist cli:
preview:
open -a firefox "http://127.0.0.1:23627"
tinymist preview --no-open $(MAIN)
I use mac, but Safari won’t auto refresh. Firefox worked.
1 Like
Excellent. That’s what I’ll use.