From 3b15d49467a4ea81c3adf101b806d7236ba395bb Mon Sep 17 00:00:00 2001 From: Volpeon Date: Wed, 23 Dec 2020 09:10:31 +0100 Subject: Better build script, allow static files in content folder --- Makefile | 5 +--- assets/style.scss | 62 ++++++++++++++++++++++++------------------------ content/robots.txt | 2 ++ scripts/build_content.sh | 36 ++++++++++++++++++---------- scripts/watch_content.sh | 3 +-- scripts/watch_sass.sh | 3 +-- static/robots.txt | 2 -- 7 files changed, 59 insertions(+), 54 deletions(-) create mode 100644 content/robots.txt delete mode 100644 static/robots.txt diff --git a/Makefile b/Makefile index 4f45201..03ef22a 100644 --- a/Makefile +++ b/Makefile @@ -22,10 +22,7 @@ build_sass: clean build_content: clean @scripts/build_content.sh -copy_static: clean - @cp -r static/* output/ - -build: build_fonts build_sass build_content copy_static +build: build_fonts build_sass build_content # @pigz -R -k -9 -- `find output -type f -iregex '.*\\.\\(css\\|js\\|json\\|html\\|xml\\|txt\\|svg\\|ico\\)'` watch_sass: build diff --git a/assets/style.scss b/assets/style.scss index f3a8b81..8e021d8 100644 --- a/assets/style.scss +++ b/assets/style.scss @@ -1,5 +1,5 @@ $font-size: 17px; -$heading-font-size: 18px; +$heading-font-size: $font-size + 1; $line-height: 1.4; $page-item-prefix-max-chars: 3ch; @@ -98,36 +98,6 @@ main { margin: 0 auto; } -.c-page-header { - margin-bottom: $line-height * 2rem; - overflow: hidden; - - &::after { - position: relative; - z-index: -10; - content: str-repeat("░", 120); - display: block; - height: $line-height; - margin-top: px-to-em(2px); - padding-top: px-to-em(2px); - color: var(--fg-minus); - border-top: 1px solid var(--fg-minus); - } - - &--sm { - display: none; - } - - @media (max-width: 700px) { - display: none; - - &--sm, - &--nohide { - display: block; - } - } -} - code { color: var(--code-fg); } @@ -259,6 +229,36 @@ blockquote { border-left: 2px solid var(--bg-plus); } +.c-page-header { + margin-bottom: $line-height * 2rem; + overflow: hidden; + + &::after { + position: relative; + z-index: -10; + content: str-repeat("░", 120); + display: block; + height: $line-height; + margin-top: px-to-em(2px); + padding-top: px-to-em(2px); + color: var(--fg-minus); + border-top: 1px solid var(--fg-minus); + } + + &--sm { + display: none; + } + + @media (max-width: 700px) { + display: none; + + &--sm, + &--nohide { + display: block; + } + } +} + .s-page { padding-left: $page-item-prefix-width; diff --git a/content/robots.txt b/content/robots.txt new file mode 100644 index 0000000..1f53798 --- /dev/null +++ b/content/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: / diff --git a/scripts/build_content.sh b/scripts/build_content.sh index bd35694..460a3fe 100755 --- a/scripts/build_content.sh +++ b/scripts/build_content.sh @@ -10,27 +10,37 @@ target () { fi } -compile () { - TARGET=$(target "$1") - mkdir -p $(dirname "$TARGET") - pandoc "$1" \ - -f markdown \ - -t html5 \ - --template templates/base.html \ - -o "$TARGET" \ - --metadata sitetitle="$SITE_TITLE" +handle () { + TARGET=$(target "$1") + mkdir -p $(dirname "$TARGET") + + if [ "${1#*.}" = "md" ]; then + echo "[COMPILE] $1 -> $TARGET" + + pandoc "$1" \ + -f markdown \ + -t html5 \ + --template templates/base.html \ + -o "$TARGET" \ + --metadata sitetitle="$SITE_TITLE" + else + echo "[COPY ] $1 -> $TARGET" + + cp "$1" "$TARGET" + fi } if [ -z "$1" ]; then find content/ \ - -iname "*.md" \ -type f \ | while read FILE do - compile "$FILE" + handle "$FILE" done elif [ "$2" = "delete" ]; then - rm -rf $(target $1) + TARGET=$(target "$1") + echo "[DELETE] $1 -> $TARGET" + rm -rf $TARGET else - compile "$1" + handle "$1" fi diff --git a/scripts/watch_content.sh b/scripts/watch_content.sh index 60f7b07..c4f55fb 100755 --- a/scripts/watch_content.sh +++ b/scripts/watch_content.sh @@ -1,9 +1,8 @@ #!/bin/bash -inotifywait -rme create,close_write,delete,move --format "%w%f" content \ +inotifywait -qrme close_write,delete,move --format "%w%f" content \ | while read FILENAME do - printf "Change detected: %s\n" "$FILENAME" if [ -f "$FILENAME" ]; then scripts/build_content.sh "$FILENAME" elif [ ! -d "$FILENAME" ]; then diff --git a/scripts/watch_sass.sh b/scripts/watch_sass.sh index 97fd207..a5649e7 100755 --- a/scripts/watch_sass.sh +++ b/scripts/watch_sass.sh @@ -1,8 +1,7 @@ #!/bin/bash -inotifywait -rme create,close_write,delete,move --format "%w%f" assets \ +inotifywait -qrme close_write,delete,move --format "%w%f" assets \ | while read FILENAME do - printf "Change detected: %s\n" "$FILENAME" scripts/build_sass.sh done diff --git a/static/robots.txt b/static/robots.txt deleted file mode 100644 index 1f53798..0000000 --- a/static/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Disallow: / -- cgit v1.2.3-54-g00ecf