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 +++++++- site.defaults.conf | 8 ++++++++ templates/base.html | 13 ++++++------- templates/categoriesByCount.html | 7 ------- templates/categoriesById.html | 7 ------- templates/feed.xml | 1 + templates/list.html | 4 ++++ templates/page.html | 1 + templates/pageHeader.html | 17 ----------------- templates/pageHeaderSm.html | 10 ---------- templates/pagelistByYear.html | 11 ----------- templates/partials/categoriesByCount.html | 7 +++++++ templates/partials/categoriesById.html | 7 +++++++ templates/partials/pageHeader.html | 17 +++++++++++++++++ templates/partials/pageHeaderSm.html | 10 ++++++++++ templates/partials/pagelistByYear.html | 11 +++++++++++ 23 files changed, 135 insertions(+), 82 deletions(-) create mode 100644 site.defaults.conf delete mode 100644 templates/categoriesByCount.html delete mode 100644 templates/categoriesById.html create mode 100644 templates/list.html create mode 100644 templates/page.html delete mode 100644 templates/pageHeader.html delete mode 100644 templates/pageHeaderSm.html delete mode 100644 templates/pagelistByYear.html create mode 100644 templates/partials/categoriesByCount.html create mode 100644 templates/partials/categoriesById.html create mode 100644 templates/partials/pageHeader.html create mode 100644 templates/partials/pageHeaderSm.html create mode 100644 templates/partials/pagelistByYear.html 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" diff --git a/site.defaults.conf b/site.defaults.conf new file mode 100644 index 0000000..1c44c50 --- /dev/null +++ b/site.defaults.conf @@ -0,0 +1,8 @@ +SITE="https://volpeon.ink/" + +CONTENT_DIR="content/" +ASSETS_DIR="assets/" +FILTERS_DIR="filters/" +METADATA_DIR="metadata/" +TEMPLATES_DIR="templates/" +OUTPUT_DIR="output/" diff --git a/templates/base.html b/templates/base.html index 48d7c72..76dd0ba 100644 --- a/templates/base.html +++ b/templates/base.html @@ -45,22 +45,21 @@
$if(is_home)$ $endif$ -$body$ - - $if(section.is_blog)$ - ${categoriesById()} - ${pagelistByYear()} + $if(pages)$ +${list()} + $else$ +${page()} $endif$
$if(is_home)$