-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bezel: ./serve.sh now runs both a http server and tailwindcss
- Loading branch information
1 parent
250f8f6
commit 7399900
Showing
2 changed files
with
29 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# Build the project if needed | ||
[ ! -d "Output" ] && ./build.sh | ||
|
||
# Enable us to be able to serve this directory under the path /bezel | ||
SERVE_DIR=`mktemp -d` | ||
ln -s "$(realpath Output)" $SERVE_DIR/bezel | ||
python3 -m http.server --directory $SERVE_DIR 8000 | ||
rm -rf $SERVE_DIR | ||
|
||
# Start python HTTP server in background | ||
python3 -m http.server --directory $SERVE_DIR 8000 & | ||
PID1=$! | ||
echo "Python server running with PID: $PID1" | ||
|
||
# Start Tailwind CSS process in background | ||
./tailwindcss -i Styles/input.css -o Output/styles.css --watch=always & | ||
PID2=$! | ||
echo "Tailwind running with PID: $PID2" | ||
|
||
# Function to handle script termination | ||
cleanup() { | ||
echo "Stopping all processes..." | ||
kill $PID1 $PID2 | ||
rm -rf "$SERVE_DIR" | ||
echo "Cleanup complete and processes stopped." | ||
} | ||
|
||
# Trap SIGINT and exit signals | ||
trap cleanup INT TERM | ||
|
||
# Wait for both processes to finish | ||
wait $PID1 $PID2 |