use watch script

This commit is contained in:
Brian Hicks 2019-04-02 15:26:32 -05:00
parent 85e255e8c7
commit 3ac6cdf955
2 changed files with 19 additions and 1 deletions

View File

@ -61,7 +61,7 @@ public/%: styleguide-app/%
.PHONY: serve-public
serve-public: public
./scripts/serve.sh public
./scripts/watch.sh
# plumbing

18
scripts/watch.sh Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail
# start a web server
./scripts/serve.sh public &
SERVER_PID=$!
# start a watcher
find src styleguide-app -type f -not -ipath '*elm-stuff*' | entr make public &
WATCHER_PID=$!
# wait for an interrupt and kill both of them
cleanup() {
kill $SERVER_PID $WATCHER_PID
}
trap cleanup EXIT INT
while : ; do sleep 10; done