28 lines
424 B
Bash
28 lines
424 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
BINARY=hermes
|
||
|
PID=
|
||
|
|
||
|
set -e
|
||
|
|
||
|
function restart() {
|
||
|
date +%s.%N > public/__hotreload__
|
||
|
set +e
|
||
|
[[ -z "$PID" ]] || kill -15 $PID
|
||
|
make build -B
|
||
|
set -e
|
||
|
./$BINARY 2>&1 &
|
||
|
PID=$(pidof $BINARY)
|
||
|
}
|
||
|
|
||
|
function cleanup() {
|
||
|
rm -f public/__hotreload__
|
||
|
[[ -z "$PID" ]] || kill -15 $PID
|
||
|
}
|
||
|
trap cleanup EXIT
|
||
|
|
||
|
restart
|
||
|
while inotifywait -r -e modify fonts/ lib/ pages/ public/ server/; do
|
||
|
restart
|
||
|
done
|