@@ -8,6 +8,17 @@ if ! docker info &> /dev/null; then
88 exit 1
99fi
1010
11+ # Check if fswatch is installed, if not install it
12+ if ! command -v fswatch & > /dev/null; then
13+ echo " 🔄 Installing fswatch..."
14+ if [[ " $OSTYPE " == " darwin" * ]]; then
15+ brew install fswatch
16+ else
17+ echo " ❌ fswatch is required but not installed. Please install it manually for your system."
18+ exit 1
19+ fi
20+ fi
21+
1122# Cleanup previous development files
1223echo -e " 🗑️ Cleaning up previously generated files...\n"
1324rm -rf pages/api/servers
@@ -26,15 +37,30 @@ rm -rf "$DEV_DIR"/*
2637echo -e " 🔄 Copying site content to development directory...\n"
2738cp -r pages/* " $DEV_DIR " /
2839
40+ # Function to run prepare.sh
41+ run_prepare () {
42+ echo -e " \n🔄 Changes detected, updating development environment..."
43+ cp -r pages/* " $DEV_DIR " /
44+ ./scripts/prepare.sh " $DEV_DIR "
45+ echo -e " ✅ Update complete!\n"
46+ }
47+
2948# Run the common preparation script
3049mkdir -p " $DEV_DIR /registry"
3150./scripts/prepare.sh " $DEV_DIR "
3251
3352echo -e " ✅ Setup complete!\n"
3453
35- echo -e " \n🌐 Starting Jekyll development server..."
54+ echo -e " \n👀 Watching for changes in pages directory..."
55+ echo -e " 🌐 Starting Jekyll development server..."
3656echo " Access the site at http://localhost:4000"
3757echo -e " Press Ctrl+C to stop the server\n"
58+
59+ # Start fswatch in the background to watch for changes
60+ fswatch -o pages | while read ; do
61+ run_prepare
62+ done &
63+
3864# Start Jekyll dev server using Docker from the _dev directory
3965cd " $DEV_DIR " && docker run --rm -it \
4066 -v " $PWD :/srv/jekyll" \
0 commit comments