summaryrefslogtreecommitdiff
path: root/serve-http.sh
blob: 874b58690b1b5a84ed42f8dab48707e14b199876 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

# this script is for previewing site changes ONLY!! it should not be used to
# actually serve a site. use apache or nginx or something for that.

# launch webserver
python3 -m http.server --directory public/ &
server_pid="$!"
echo "server launched with PID $server_pid"

# kill server on exit
trap "kill $server_pid && echo && echo \"bye!\"" EXIT

# rebuild on file changes (inotifywait is from inotify-tools)
while inotifywait -qr --event modify .; do
    echo "rebuilding site..."
    argent
    echo "done."
done