- Add reactable-demo post exercising the full statdown/depkit htmlwidget pipeline (two reactable tables with filtering) - Replace renv::restore() with renv::load() using explicit project root in Makefile and watch-rmd.sh — renv could not find the lockfile when cd'd into post subdirectories Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
20 lines
638 B
Bash
20 lines
638 B
Bash
#!/bin/bash
|
|
WATCH_DIR="content/posts"
|
|
PROJECT_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
LIBS_DIR="static/libs"
|
|
LIBS_URL="/libs"
|
|
|
|
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::load("'"${PROJECT_ROOT}"'"); statdown::statdown_render("index.Rmd", output_root = "'"${PROJECT_ROOT}/${LIBS_DIR}"'", url_root = "'"${LIBS_URL}"'")')
|
|
|
|
echo "✅ Rendered ${FILE}"
|
|
fi
|
|
done
|