diff options
author | Volpeon <git@volpeon.ink> | 2020-12-21 21:16:43 +0100 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2020-12-21 21:16:43 +0100 |
commit | fe48bee6e9d409704bc09b1ae5527e2de1115fc8 (patch) | |
tree | a61a373ee1461f72d5e866ebac7074941bf1d08b | |
parent | Use Pandoc to write content in Markdown (diff) | |
download | volpeon.ink-fe48bee6e9d409704bc09b1ae5527e2de1115fc8.tar.gz volpeon.ink-fe48bee6e9d409704bc09b1ae5527e2de1115fc8.tar.bz2 volpeon.ink-fe48bee6e9d409704bc09b1ae5527e2de1115fc8.zip |
Added makefile
-rw-r--r-- | Makefile | 30 | ||||
-rwxr-xr-x | scripts/build_content.sh | 8 | ||||
-rwxr-xr-x | scripts/build_fonts.sh (renamed from build.sh) | 12 | ||||
-rwxr-xr-x | scripts/build_sass.sh | 4 | ||||
-rwxr-xr-x | scripts/serve.sh | 3 | ||||
-rwxr-xr-x | scripts/watch_content.sh | 5 | ||||
-rwxr-xr-x | scripts/watch_sass.sh | 5 | ||||
-rwxr-xr-x | watch.sh | 6 |
8 files changed, 55 insertions, 18 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..19ad5a7 --- /dev/null +++ b/Makefile | |||
@@ -0,0 +1,30 @@ | |||
1 | all: build | ||
2 | |||
3 | clean: | ||
4 | @rm -rf dist/* | ||
5 | |||
6 | build_fonts: clean | ||
7 | @scripts/build_fonts.sh | ||
8 | |||
9 | build_sass: clean | ||
10 | @scripts/build_sass.sh | ||
11 | |||
12 | build_content: clean | ||
13 | @scripts/build_content.sh | ||
14 | |||
15 | build: build_fonts build_sass build_content | ||
16 | |||
17 | watch_sass: build | ||
18 | @scripts/watch_sass.sh | ||
19 | |||
20 | watch_content: build | ||
21 | @scripts/watch_content.sh | ||
22 | |||
23 | watch: watch_sass watch_content | ||
24 | |||
25 | serve_only: build | ||
26 | @scripts/serve.sh | ||
27 | |||
28 | serve: watch serve_only | ||
29 | |||
30 | .PHONY: all build watch serve | ||
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 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | SITE_TITLE="Volpeon's Den" | ||
4 | |||
5 | find content/ \ | ||
6 | -iname "*.md" \ | ||
7 | -type f \ | ||
8 | -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/build.sh b/scripts/build_fonts.sh index bc733cc..d7c5e13 100755 --- a/build.sh +++ b/scripts/build_fonts.sh | |||
@@ -1,12 +1,5 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | SITE_TITLE="Volpeon's Den" | ||
4 | |||
5 | rm -rf dist/* | ||
6 | |||
7 | sassc assets/style.scss dist/style.css | ||
8 | node_modules/.bin/postcss dist/style.css -r | ||
9 | |||
10 | pyftsubset assets/iosevka-term-ss09-regular.ttf \ | 3 | pyftsubset assets/iosevka-term-ss09-regular.ttf \ |
11 | --text-file='assets/glyphs.txt' \ | 4 | --text-file='assets/glyphs.txt' \ |
12 | --layout-features+=ss09,dlig \ | 5 | --layout-features+=ss09,dlig \ |
@@ -18,8 +11,3 @@ pyftsubset assets/iosevka-term-ss09-bold.ttf \ | |||
18 | --layout-features+=ss09,dlig \ | 11 | --layout-features+=ss09,dlig \ |
19 | --flavor='woff2' \ | 12 | --flavor='woff2' \ |
20 | --output-file='dist/iosevka-term-ss09-bold.woff2' | 13 | --output-file='dist/iosevka-term-ss09-bold.woff2' |
21 | |||
22 | find content/ \ | ||
23 | -iname "*.md" \ | ||
24 | -type f \ | ||
25 | -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_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 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | sassc assets/style.scss dist/style.css | ||
4 | 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 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | 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 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | while inotifywait -r -e close_write content; do | ||
4 | scripts/build_content.sh | ||
5 | 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 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | while inotifywait -r -e close_write assets; do | ||
4 | scripts/build_sass.sh | ||
5 | 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 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | while inotifywait -r -e close_write assets; do | ||
4 | sassc assets/style.scss dist/style.css | ||
5 | node_modules/.bin/postcss dist/style.css -r | ||
6 | done | ||