From d90d07fa3938c944fe8897e7ce1d995bd660573d Mon Sep 17 00:00:00 2001 From: Volpeon Date: Wed, 30 Dec 2020 11:30:59 +0100 Subject: Better templates structure, better script config --- scripts/build_content.sh | 10 ++++------ scripts/build_fonts.sh | 26 ++++++++++++++++---------- scripts/build_sass.sh | 10 ++++++++-- scripts/watch_content.sh | 8 +++++++- scripts/watch_filters.sh | 8 +++++++- scripts/watch_metadata.sh | 8 +++++++- scripts/watch_sass.sh | 8 +++++++- scripts/watch_templates.sh | 8 +++++++- 8 files changed, 63 insertions(+), 23 deletions(-) (limited to 'scripts') diff --git a/scripts/build_content.sh b/scripts/build_content.sh index 78857b5..e57cfed 100755 --- a/scripts/build_content.sh +++ b/scripts/build_content.sh @@ -1,12 +1,10 @@ #!/bin/bash -SITE="https://volpeon.ink/" +source "site.defaults.conf" -CONTENT_DIR="content/" -FILTERS_DIR="filters/" -METADATA_DIR="metadata/" -TEMPLATES_DIR="templates/" -OUTPUT_DIR="output/" +if [ -f "site.conf" ]; then + source "site.conf" +fi get_filters() { filters_args="" diff --git a/scripts/build_fonts.sh b/scripts/build_fonts.sh index bd168df..292cef2 100755 --- a/scripts/build_fonts.sh +++ b/scripts/build_fonts.sh @@ -1,17 +1,23 @@ #!/bin/bash -echo -e "\033[0;32m[MINIFY ]\033[0m assets/fonts/iosevka-term-ss09-regular.ttf -> output/iosevka-term-ss09-regular.woff2" +source "site.defaults.conf" -pyftsubset assets/fonts/iosevka-term-ss09-regular.ttf \ - --text-file='assets/fonts/glyphs.txt' \ +if [ -f "site.conf" ]; then + source "site.conf" +fi + +echo -e "\033[0;32m[MINIFY ]\033[0m ${ASSETS_DIR}fonts/iosevka-term-ss09-regular.ttf -> ${OUTPUT_DIR}iosevka-term-ss09-regular.woff2" + +pyftsubset ${ASSETS_DIR}fonts/iosevka-term-ss09-regular.ttf \ + --text-file="${ASSETS_DIR}fonts/glyphs.txt" \ --layout-features+=ss09,dlig \ - --flavor='woff2' \ - --output-file='output/iosevka-term-ss09-regular.woff2' + --flavor="woff2" \ + --output-file="${OUTPUT_DIR}iosevka-term-ss09-regular.woff2" -echo -e "\033[0;32m[MINIFY ]\033[0m assets/fonts/iosevka-term-ss09-bold.ttf -> output/iosevka-term-ss09-bold.woff2" +echo -e "\033[0;32m[MINIFY ]\033[0m ${ASSETS_DIR}fonts/iosevka-term-ss09-bold.ttf -> ${OUTPUT_DIR}iosevka-term-ss09-bold.woff2" -pyftsubset assets/fonts/iosevka-term-ss09-bold.ttf \ - --text-file='assets/fonts/glyphs.txt' \ +pyftsubset ${ASSETS_DIR}fonts/iosevka-term-ss09-bold.ttf \ + --text-file="${ASSETS_DIR}fonts/glyphs.txt" \ --layout-features+=ss09,dlig \ - --flavor='woff2' \ - --output-file='output/iosevka-term-ss09-bold.woff2' + --flavor="woff2" \ + --output-file="${OUTPUT_DIR}iosevka-term-ss09-bold.woff2" diff --git a/scripts/build_sass.sh b/scripts/build_sass.sh index df1c0a9..5bb24d4 100755 --- a/scripts/build_sass.sh +++ b/scripts/build_sass.sh @@ -1,4 +1,10 @@ #!/bin/bash -echo -e "\033[0;32m[COMPILE ]\033[0m assets/css/style.scss -> output/style.css" -sassc assets/css/style.scss | node_modules/.bin/csso > output/style.css +source "site.defaults.conf" + +if [ -f "site.conf" ]; then + source "site.conf" +fi + +echo -e "\033[0;32m[COMPILE ]\033[0m ${ASSETS_DIR}css/style.scss -> ${OUTPUT_DIR}style.css" +sassc ${ASSETS_DIR}css/style.scss | node_modules/.bin/csso > "${OUTPUT_DIR}style.css" diff --git a/scripts/watch_content.sh b/scripts/watch_content.sh index f0d1b42..92719d3 100755 --- a/scripts/watch_content.sh +++ b/scripts/watch_content.sh @@ -1,6 +1,12 @@ #!/bin/bash -inotifywait -qrme close_write,delete,move --format "%w%f" content \ +source "site.defaults.conf" + +if [ -f "site.conf" ]; then + source "site.conf" +fi + +inotifywait -qrme close_write,delete,move --format "%w%f" "${CONTENT_DIR%/}" \ | while read file do if [ -f "$file" ]; then diff --git a/scripts/watch_filters.sh b/scripts/watch_filters.sh index 9bb3b44..21fb686 100755 --- a/scripts/watch_filters.sh +++ b/scripts/watch_filters.sh @@ -1,6 +1,12 @@ #!/bin/bash -inotifywait -qrme close_write,delete,move --format "%w%f" filters \ +source "site.defaults.conf" + +if [ -f "site.conf" ]; then + source "site.conf" +fi + +inotifywait -qrme close_write,delete,move --format "%w%f" "${FILTERS_DIR%/}" \ | while read file do scripts/build_content.sh "all_md" diff --git a/scripts/watch_metadata.sh b/scripts/watch_metadata.sh index 780177e..cc02ea7 100755 --- a/scripts/watch_metadata.sh +++ b/scripts/watch_metadata.sh @@ -1,6 +1,12 @@ #!/bin/bash -inotifywait -qrme close_write,delete,move --format "%w%f" metadata \ +source "site.defaults.conf" + +if [ -f "site.conf" ]; then + source "site.conf" +fi + +inotifywait -qrme close_write,delete,move --format "%w%f" "${METADATA_DIR%/}" \ | while read file do scripts/build_content.sh "all_md" diff --git a/scripts/watch_sass.sh b/scripts/watch_sass.sh index d451135..11c210a 100755 --- a/scripts/watch_sass.sh +++ b/scripts/watch_sass.sh @@ -1,6 +1,12 @@ #!/bin/bash -inotifywait -qrme close_write,delete,move --format "%w%f" assets \ +source "site.defaults.conf" + +if [ -f "site.conf" ]; then + source "site.conf" +fi + +inotifywait -qrme close_write,delete,move --format "%w%f" "${ASSETS_DIR}css" \ | while read file do scripts/build_sass.sh diff --git a/scripts/watch_templates.sh b/scripts/watch_templates.sh index 9b464d4..b6149e7 100755 --- a/scripts/watch_templates.sh +++ b/scripts/watch_templates.sh @@ -1,6 +1,12 @@ #!/bin/bash -inotifywait -qrme close_write,delete,move --format "%w%f" templates \ +source "site.defaults.conf" + +if [ -f "site.conf" ]; then + source "site.conf" +fi + +inotifywait -qrme close_write,delete,move --format "%w%f" "${TEMPLATES_DIR%/}" \ | while read file do scripts/build_content.sh "all_md" -- cgit v1.2.3-70-g09d2