diff options
-rwxr-xr-x | scripts/build_content.sh | 8 | ||||
-rwxr-xr-x | scripts/watch_content.sh | 12 | ||||
-rwxr-xr-x | scripts/watch_sass.sh | 4 |
3 files changed, 14 insertions, 10 deletions
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 @@ | |||
3 | SITE_TITLE="Volpeon's Den" | 3 | SITE_TITLE="Volpeon's Den" |
4 | 4 | ||
5 | target () { | 5 | target () { |
6 | echo "dist/$(echo ${1%.md}.html | cut -sd / -f 2-)" | 6 | if [ "${1#*.}" = "md" ]; then |
7 | echo "dist/$(echo "${1%.md}.html" | cut -sd / -f 2-)" | ||
8 | else | ||
9 | echo "dist/$(echo "$1" | cut -sd / -f 2-)" | ||
10 | fi | ||
7 | } | 11 | } |
8 | 12 | ||
9 | compile () { | 13 | compile () { |
@@ -26,7 +30,7 @@ if [ -z "$1" ]; then | |||
26 | done | 30 | done |
27 | else | 31 | else |
28 | if [ "$2" = "delete" ]; then | 32 | if [ "$2" = "delete" ]; then |
29 | rm $(target $1) | 33 | rm -rf $(target $1) |
30 | else | 34 | else |
31 | compile "$1" | 35 | compile "$1" |
32 | fi | 36 | 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 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | inotifywait -rme create,close_write,delete,move --format "%f" content \ | 3 | inotifywait -rme create,close_write,delete,move --format "%w%f" content \ |
4 | | while read FILENAME | 4 | | while read FILENAME |
5 | do | 5 | do |
6 | printf "Change detected: %s\n" "content/$FILENAME" | 6 | printf "Change detected: %s\n" "$FILENAME" |
7 | if [ -f "content/$FILENAME" ]; then | 7 | if [ -f "$FILENAME" ]; then |
8 | scripts/build_content.sh "content/$FILENAME" | 8 | scripts/build_content.sh "$FILENAME" |
9 | else | 9 | elif [ ! -d "$FILENAME" ]; then |
10 | scripts/build_content.sh "content/$FILENAME" "delete" | 10 | scripts/build_content.sh "$FILENAME" "delete" |
11 | fi | 11 | fi |
12 | done | 12 | 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 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | inotifywait -rme create,close_write,delete,move --format "%f" assets \ | 3 | inotifywait -rme create,close_write,delete,move --format "%w%f" assets \ |
4 | | while read FILENAME | 4 | | while read FILENAME |
5 | do | 5 | do |
6 | printf "Change detected: %s\n" "assets/$FILENAME" | 6 | printf "Change detected: %s\n" "$FILENAME" |
7 | scripts/build_sass.sh | 7 | scripts/build_sass.sh |
8 | done | 8 | done |