From fe48bee6e9d409704bc09b1ae5527e2de1115fc8 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Mon, 21 Dec 2020 21:16:43 +0100 Subject: Added makefile --- Makefile | 30 ++++++++++++++++++++++++++++++ build.sh | 25 ------------------------- scripts/build_content.sh | 8 ++++++++ scripts/build_fonts.sh | 13 +++++++++++++ scripts/build_sass.sh | 4 ++++ scripts/serve.sh | 3 +++ scripts/watch_content.sh | 5 +++++ scripts/watch_sass.sh | 5 +++++ watch.sh | 6 ------ 9 files changed, 68 insertions(+), 31 deletions(-) create mode 100644 Makefile delete mode 100755 build.sh create mode 100755 scripts/build_content.sh create mode 100755 scripts/build_fonts.sh create mode 100755 scripts/build_sass.sh create mode 100755 scripts/serve.sh create mode 100755 scripts/watch_content.sh create mode 100755 scripts/watch_sass.sh delete mode 100755 watch.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..19ad5a7 --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +all: build + +clean: + @rm -rf dist/* + +build_fonts: clean + @scripts/build_fonts.sh + +build_sass: clean + @scripts/build_sass.sh + +build_content: clean + @scripts/build_content.sh + +build: build_fonts build_sass build_content + +watch_sass: build + @scripts/watch_sass.sh + +watch_content: build + @scripts/watch_content.sh + +watch: watch_sass watch_content + +serve_only: build + @scripts/serve.sh + +serve: watch serve_only + +.PHONY: all build watch serve diff --git a/build.sh b/build.sh deleted file mode 100755 index bc733cc..0000000 --- a/build.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -SITE_TITLE="Volpeon's Den" - -rm -rf dist/* - -sassc assets/style.scss dist/style.css -node_modules/.bin/postcss dist/style.css -r - -pyftsubset assets/iosevka-term-ss09-regular.ttf \ - --text-file='assets/glyphs.txt' \ - --layout-features+=ss09,dlig \ - --flavor='woff2' \ - --output-file='dist/iosevka-term-ss09-regular.woff2' - -pyftsubset assets/iosevka-term-ss09-bold.ttf \ - --text-file='assets/glyphs.txt' \ - --layout-features+=ss09,dlig \ - --flavor='woff2' \ - --output-file='dist/iosevka-term-ss09-bold.woff2' - -find content/ \ - -iname "*.md" \ - -type f \ - -exec sh -c 'TARGET=dist/$(echo ${0%.md}.html | cut -sd / -f 2-); mkdir -p $(dirname $TARGET) && pandoc "${0}" -t html5 --template templates/base.html -o "$TARGET" --metadata sitetitle="$1"' {} "$SITE_TITLE" \; diff --git a/scripts/build_content.sh b/scripts/build_content.sh new file mode 100755 index 0000000..4476d45 --- /dev/null +++ b/scripts/build_content.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +SITE_TITLE="Volpeon's Den" + +find content/ \ + -iname "*.md" \ + -type f \ + -exec sh -c 'TARGET=dist/$(echo ${0%.md}.html | cut -sd / -f 2-); mkdir -p $(dirname $TARGET) && pandoc "${0}" -t html5 --template templates/base.html -o "$TARGET" --metadata sitetitle="$1"' {} "$SITE_TITLE" \; diff --git a/scripts/build_fonts.sh b/scripts/build_fonts.sh new file mode 100755 index 0000000..d7c5e13 --- /dev/null +++ b/scripts/build_fonts.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +pyftsubset assets/iosevka-term-ss09-regular.ttf \ + --text-file='assets/glyphs.txt' \ + --layout-features+=ss09,dlig \ + --flavor='woff2' \ + --output-file='dist/iosevka-term-ss09-regular.woff2' + +pyftsubset assets/iosevka-term-ss09-bold.ttf \ + --text-file='assets/glyphs.txt' \ + --layout-features+=ss09,dlig \ + --flavor='woff2' \ + --output-file='dist/iosevka-term-ss09-bold.woff2' diff --git a/scripts/build_sass.sh b/scripts/build_sass.sh new file mode 100755 index 0000000..6334acc --- /dev/null +++ b/scripts/build_sass.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +sassc assets/style.scss dist/style.css +node_modules/.bin/postcss dist/style.css -r diff --git a/scripts/serve.sh b/scripts/serve.sh new file mode 100755 index 0000000..10e45a4 --- /dev/null +++ b/scripts/serve.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +python -m http.server --bind 127.0.0.1 --directory dist diff --git a/scripts/watch_content.sh b/scripts/watch_content.sh new file mode 100755 index 0000000..59d60a4 --- /dev/null +++ b/scripts/watch_content.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +while inotifywait -r -e close_write content; do + scripts/build_content.sh +done diff --git a/scripts/watch_sass.sh b/scripts/watch_sass.sh new file mode 100755 index 0000000..69605dc --- /dev/null +++ b/scripts/watch_sass.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +while inotifywait -r -e close_write assets; do + scripts/build_sass.sh +done diff --git a/watch.sh b/watch.sh deleted file mode 100755 index 0aceb1c..0000000 --- a/watch.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -while inotifywait -r -e close_write assets; do - sassc assets/style.scss dist/style.css - node_modules/.bin/postcss dist/style.css -r -done -- cgit v1.2.3-70-g09d2