From e7d6404ab184a5f6a8645bd0ac90b3676b8c5efc Mon Sep 17 00:00:00 2001 From: Volpeon Date: Fri, 25 Dec 2020 13:22:37 +0100 Subject: Improved CSS definitions, more fine-grained content build script --- scripts/build_content.sh | 28 +++++++++++++++++++++++----- scripts/watch_content.sh | 4 ++-- scripts/watch_metadata.sh | 2 +- scripts/watch_templates.sh | 2 +- 4 files changed, 27 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/build_content.sh b/scripts/build_content.sh index ca75120..6ce857f 100755 --- a/scripts/build_content.sh +++ b/scripts/build_content.sh @@ -35,10 +35,28 @@ if [ -z "$1" ]; then do handle "$FILE" done -elif [ "$2" = "delete" ]; then - TARGET=$(target "$1") - echo "[DELETE ] $1 -> $TARGET" - rm -rf $TARGET +elif [ "$1" = "md" ]; then + find content/ \ + -type f \ + -name "*.md" \ + | while read FILE + do + handle "$FILE" + done +elif [ "$1" = "single" ]; then + if [ -z "$2" ]; then + echo "[ERROR ] \"single\" operation requires file argument" + else + handle "$2" + fi +elif [ "$1" = "delete" ]; then + if [ -z "$2" ]; then + echo "[ERROR ] \"delete\" operation requires file argument" + else + TARGET=$(target "$2") + echo "[DELETE ] $2 -> $TARGET" + rm -rf $TARGET + fi else - handle "$1" + echo "[ERROR ] Unknown operation: \"$1\"" fi diff --git a/scripts/watch_content.sh b/scripts/watch_content.sh index c4f55fb..769f2c5 100755 --- a/scripts/watch_content.sh +++ b/scripts/watch_content.sh @@ -4,8 +4,8 @@ inotifywait -qrme close_write,delete,move --format "%w%f" content \ | while read FILENAME do if [ -f "$FILENAME" ]; then - scripts/build_content.sh "$FILENAME" + scripts/build_content.sh "single" "$FILENAME" elif [ ! -d "$FILENAME" ]; then - scripts/build_content.sh "$FILENAME" "delete" + scripts/build_content.sh "delete" "$FILENAME" fi done diff --git a/scripts/watch_metadata.sh b/scripts/watch_metadata.sh index af2e6a7..4323c90 100755 --- a/scripts/watch_metadata.sh +++ b/scripts/watch_metadata.sh @@ -3,5 +3,5 @@ inotifywait -qrme close_write,delete,move --format "%w%f" metadata \ | while read FILENAME do - scripts/build_content.sh + scripts/build_content.sh "md" done diff --git a/scripts/watch_templates.sh b/scripts/watch_templates.sh index 160a46c..9c7e787 100755 --- a/scripts/watch_templates.sh +++ b/scripts/watch_templates.sh @@ -3,5 +3,5 @@ inotifywait -qrme close_write,delete,move --format "%w%f" templates \ | while read FILENAME do - scripts/build_content.sh + scripts/build_content.sh "md" done -- cgit v1.2.3-54-g00ecf