# List available recipes
default:
    @just --list

# Build and serve one site with autoreload on content changes
preview site port:
    cd {{site}} && uv run --quiet --with pelican --with markdown -- pelican content -o output -s pelicanconf.py -lr -p {{port}}

# Preview flux.vision at http://localhost:8110
flux: (preview "flux.vision" "8110")

# Preview tobias.raayoni-last.com at http://localhost:8111
tobias: (preview "tobias.raayoni-last.com" "8111")

# Preview randogoth.com at http://localhost:8112
randogoth: (preview "randogoth.com" "8112")

# Preview all three sites at once, each on its own port
preview-all:
    just flux &
    just tobias &
    just randogoth &
    wait

# Kill any backgrounded preview servers (flux, tobias, randogoth)
stop:
    # [.] rather than a literal dot: pkill -f also matches whatever shell is
    # running this very command, since its argv contains the pattern text
    # too. A dot there would self-match; the bracket form only matches the
    # real server processes' plain "pelicanconf.py", not its own argv.
    pkill -f 'pelicanconf[.]py' || true
