From 06ec7c2f0e2c30dd41978461bbe6d64103cb9bed Mon Sep 17 00:00:00 2001 From: Volpeon Date: Tue, 22 Dec 2020 12:15:41 +0100 Subject: Fixed problems with the build scripts --- scripts/build_content.sh | 8 ++++++-- scripts/watch_content.sh | 12 ++++++------ scripts/watch_sass.sh | 4 ++-- 3 files changed, 14 insertions(+), 10 deletions(-) (limited to 'scripts') diff --git a/scripts/build_content.sh b/scripts/build_content.sh index 992414d..e15293e 100755 --- a/scripts/build_content.sh +++ b/scripts/build_content.sh @@ -3,7 +3,11 @@ SITE_TITLE="Volpeon's Den" target () { - echo "dist/$(echo ${1%.md}.html | cut -sd / -f 2-)" + if [ "${1#*.}" = "md" ]; then + echo "dist/$(echo "${1%.md}.html" | cut -sd / -f 2-)" + else + echo "dist/$(echo "$1" | cut -sd / -f 2-)" + fi } compile () { @@ -26,7 +30,7 @@ if [ -z "$1" ]; then done else if [ "$2" = "delete" ]; then - rm $(target $1) + rm -rf $(target $1) else compile "$1" fi diff --git a/scripts/watch_content.sh b/scripts/watch_content.sh index 38567dc..60f7b07 100755 --- a/scripts/watch_content.sh +++ b/scripts/watch_content.sh @@ -1,12 +1,12 @@ #!/bin/bash -inotifywait -rme create,close_write,delete,move --format "%f" content \ +inotifywait -rme create,close_write,delete,move --format "%w%f" content \ | while read FILENAME do - printf "Change detected: %s\n" "content/$FILENAME" - if [ -f "content/$FILENAME" ]; then - scripts/build_content.sh "content/$FILENAME" - else - scripts/build_content.sh "content/$FILENAME" "delete" + printf "Change detected: %s\n" "$FILENAME" + if [ -f "$FILENAME" ]; then + scripts/build_content.sh "$FILENAME" + elif [ ! -d "$FILENAME" ]; then + scripts/build_content.sh "$FILENAME" "delete" fi done diff --git a/scripts/watch_sass.sh b/scripts/watch_sass.sh index 1b99f5d..97fd207 100755 --- a/scripts/watch_sass.sh +++ b/scripts/watch_sass.sh @@ -1,8 +1,8 @@ #!/bin/bash -inotifywait -rme create,close_write,delete,move --format "%f" assets \ +inotifywait -rme create,close_write,delete,move --format "%w%f" assets \ | while read FILENAME do - printf "Change detected: %s\n" "assets/$FILENAME" + printf "Change detected: %s\n" "$FILENAME" scripts/build_sass.sh done -- cgit v1.2.3-70-g09d2