Skip to content

Commit 0609236

Browse files
committed
watcher to execute templ build and restart main program
1 parent 9022d80 commit 0609236

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

watcher.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
# Directory to watch
4+
WATCH_DIR="/"
5+
6+
# Commands to run on change
7+
COMMAND1="../go/bin/templ generate"
8+
COMMAND2="go run main.go"
9+
10+
# Using fswatch to monitor for changes
11+
fswatch -o "$WATCH_DIR" | while read change; do
12+
echo "Change detected, running commands..."
13+
14+
# Run the commands
15+
$COMMAND1
16+
$COMMAND2
17+
done

0 commit comments

Comments
 (0)