summaryrefslogtreecommitdiff
path: root/serve-http.sh
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-01-12 17:29:28 -0600
committersanine <sanine.not@pm.me>2023-01-12 17:29:28 -0600
commitf9f8a3206298363059601f6c389584426962e5e4 (patch)
treeb0ed2fd393a1064c01aabdce548e9f84215a8c57 /serve-http.sh
parent655cd79991ec9204afb9f5acf52495c13af14d25 (diff)
wrong branch :c
Diffstat (limited to 'serve-http.sh')
-rwxr-xr-xserve-http.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/serve-http.sh b/serve-http.sh
new file mode 100755
index 0000000..874b586
--- /dev/null
+++ b/serve-http.sh
@@ -0,0 +1,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