17 lines
466 B
Bash
17 lines
466 B
Bash
#!/bin/bash
|
|
WATCH_DIR="content/posts"
|
|
|
|
echo "🚨 Watching ${WATCH_DIR} for changes..."
|
|
|
|
inotifywait -m -e close_write --format '%w%f' -r "$WATCH_DIR" | while read FILE; do
|
|
if [[ "$FILE" == *.Rmd ]]; then
|
|
POST_DIR=$(dirname "$FILE")
|
|
|
|
echo "🔄 Change detected in $FILE. Rendering..."
|
|
|
|
(cd "$POST_DIR" && Rscript -e 'renv::restore(prompt = FALSE); statdown::statdown_render("index.Rmd")')
|
|
|
|
echo "✅ Rendered ${FILE}"
|
|
fi
|
|
done
|