summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2020-12-21 21:16:43 +0100
committerVolpeon <git@volpeon.ink>2020-12-21 21:16:43 +0100
commitfe48bee6e9d409704bc09b1ae5527e2de1115fc8 (patch)
treea61a373ee1461f72d5e866ebac7074941bf1d08b
parentUse Pandoc to write content in Markdown (diff)
downloadvolpeon.ink-fe48bee6e9d409704bc09b1ae5527e2de1115fc8.tar.gz
volpeon.ink-fe48bee6e9d409704bc09b1ae5527e2de1115fc8.tar.bz2
volpeon.ink-fe48bee6e9d409704bc09b1ae5527e2de1115fc8.zip
Added makefile
-rw-r--r--Makefile30
-rwxr-xr-xscripts/build_content.sh8
-rwxr-xr-xscripts/build_fonts.sh (renamed from build.sh)12
-rwxr-xr-xscripts/build_sass.sh4
-rwxr-xr-xscripts/serve.sh3
-rwxr-xr-xscripts/watch_content.sh5
-rwxr-xr-xscripts/watch_sass.sh5
-rwxr-xr-xwatch.sh6
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 @@
1all: build
2
3clean:
4 @rm -rf dist/*
5
6build_fonts: clean
7 @scripts/build_fonts.sh
8
9build_sass: clean
10 @scripts/build_sass.sh
11
12build_content: clean
13 @scripts/build_content.sh
14
15build: build_fonts build_sass build_content
16
17watch_sass: build
18 @scripts/watch_sass.sh
19
20watch_content: build
21 @scripts/watch_content.sh
22
23watch: watch_sass watch_content
24
25serve_only: build
26 @scripts/serve.sh
27
28serve: 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
3SITE_TITLE="Volpeon's Den"
4
5find 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
3SITE_TITLE="Volpeon's Den"
4
5rm -rf dist/*
6
7sassc assets/style.scss dist/style.css
8node_modules/.bin/postcss dist/style.css -r
9
10pyftsubset assets/iosevka-term-ss09-regular.ttf \ 3pyftsubset 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
22find 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
3sassc assets/style.scss dist/style.css
4node_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
3python -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
3while inotifywait -r -e close_write content; do
4 scripts/build_content.sh
5done
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
3while inotifywait -r -e close_write assets; do
4 scripts/build_sass.sh
5done
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
3while inotifywait -r -e close_write assets; do
4 sassc assets/style.scss dist/style.css
5 node_modules/.bin/postcss dist/style.css -r
6done