diff options
author | Volpeon <git@volpeon.ink> | 2020-12-23 09:10:31 +0100 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2020-12-23 09:10:31 +0100 |
commit | 3b15d49467a4ea81c3adf101b806d7236ba395bb (patch) | |
tree | 66e1e924d535b9790730f76f3bdc148b5b774947 | |
parent | Inlined simple scripts in the makefile (diff) | |
download | volpeon.ink-3b15d49467a4ea81c3adf101b806d7236ba395bb.tar.gz volpeon.ink-3b15d49467a4ea81c3adf101b806d7236ba395bb.tar.bz2 volpeon.ink-3b15d49467a4ea81c3adf101b806d7236ba395bb.zip |
Better build script, allow static files in content folder
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | assets/style.scss | 62 | ||||
-rw-r--r-- | content/robots.txt (renamed from static/robots.txt) | 0 | ||||
-rwxr-xr-x | scripts/build_content.sh | 36 | ||||
-rwxr-xr-x | scripts/watch_content.sh | 3 | ||||
-rwxr-xr-x | scripts/watch_sass.sh | 3 |
6 files changed, 57 insertions, 52 deletions
@@ -22,10 +22,7 @@ build_sass: clean | |||
22 | build_content: clean | 22 | build_content: clean |
23 | @scripts/build_content.sh | 23 | @scripts/build_content.sh |
24 | 24 | ||
25 | copy_static: clean | 25 | build: build_fonts build_sass build_content |
26 | @cp -r static/* output/ | ||
27 | |||
28 | build: build_fonts build_sass build_content copy_static | ||
29 | # @pigz -R -k -9 -- `find output -type f -iregex '.*\\.\\(css\\|js\\|json\\|html\\|xml\\|txt\\|svg\\|ico\\)'` | 26 | # @pigz -R -k -9 -- `find output -type f -iregex '.*\\.\\(css\\|js\\|json\\|html\\|xml\\|txt\\|svg\\|ico\\)'` |
30 | 27 | ||
31 | watch_sass: build | 28 | watch_sass: build |
diff --git a/assets/style.scss b/assets/style.scss index f3a8b81..8e021d8 100644 --- a/assets/style.scss +++ b/assets/style.scss | |||
@@ -1,5 +1,5 @@ | |||
1 | $font-size: 17px; | 1 | $font-size: 17px; |
2 | $heading-font-size: 18px; | 2 | $heading-font-size: $font-size + 1; |
3 | $line-height: 1.4; | 3 | $line-height: 1.4; |
4 | 4 | ||
5 | $page-item-prefix-max-chars: 3ch; | 5 | $page-item-prefix-max-chars: 3ch; |
@@ -98,36 +98,6 @@ main { | |||
98 | margin: 0 auto; | 98 | margin: 0 auto; |
99 | } | 99 | } |
100 | 100 | ||
101 | .c-page-header { | ||
102 | margin-bottom: $line-height * 2rem; | ||
103 | overflow: hidden; | ||
104 | |||
105 | &::after { | ||
106 | position: relative; | ||
107 | z-index: -10; | ||
108 | content: str-repeat("░", 120); | ||
109 | display: block; | ||
110 | height: $line-height; | ||
111 | margin-top: px-to-em(2px); | ||
112 | padding-top: px-to-em(2px); | ||
113 | color: var(--fg-minus); | ||
114 | border-top: 1px solid var(--fg-minus); | ||
115 | } | ||
116 | |||
117 | &--sm { | ||
118 | display: none; | ||
119 | } | ||
120 | |||
121 | @media (max-width: 700px) { | ||
122 | display: none; | ||
123 | |||
124 | &--sm, | ||
125 | &--nohide { | ||
126 | display: block; | ||
127 | } | ||
128 | } | ||
129 | } | ||
130 | |||
131 | code { | 101 | code { |
132 | color: var(--code-fg); | 102 | color: var(--code-fg); |
133 | } | 103 | } |
@@ -259,6 +229,36 @@ blockquote { | |||
259 | border-left: 2px solid var(--bg-plus); | 229 | border-left: 2px solid var(--bg-plus); |
260 | } | 230 | } |
261 | 231 | ||
232 | .c-page-header { | ||
233 | margin-bottom: $line-height * 2rem; | ||
234 | overflow: hidden; | ||
235 | |||
236 | &::after { | ||
237 | position: relative; | ||
238 | z-index: -10; | ||
239 | content: str-repeat("░", 120); | ||
240 | display: block; | ||
241 | height: $line-height; | ||
242 | margin-top: px-to-em(2px); | ||
243 | padding-top: px-to-em(2px); | ||
244 | color: var(--fg-minus); | ||
245 | border-top: 1px solid var(--fg-minus); | ||
246 | } | ||
247 | |||
248 | &--sm { | ||
249 | display: none; | ||
250 | } | ||
251 | |||
252 | @media (max-width: 700px) { | ||
253 | display: none; | ||
254 | |||
255 | &--sm, | ||
256 | &--nohide { | ||
257 | display: block; | ||
258 | } | ||
259 | } | ||
260 | } | ||
261 | |||
262 | .s-page { | 262 | .s-page { |
263 | padding-left: $page-item-prefix-width; | 263 | padding-left: $page-item-prefix-width; |
264 | 264 | ||
diff --git a/static/robots.txt b/content/robots.txt index 1f53798..1f53798 100644 --- a/static/robots.txt +++ b/content/robots.txt | |||
diff --git a/scripts/build_content.sh b/scripts/build_content.sh index bd35694..460a3fe 100755 --- a/scripts/build_content.sh +++ b/scripts/build_content.sh | |||
@@ -10,27 +10,37 @@ target () { | |||
10 | fi | 10 | fi |
11 | } | 11 | } |
12 | 12 | ||
13 | compile () { | 13 | handle () { |
14 | TARGET=$(target "$1") | 14 | TARGET=$(target "$1") |
15 | mkdir -p $(dirname "$TARGET") | 15 | mkdir -p $(dirname "$TARGET") |
16 | pandoc "$1" \ | 16 | |
17 | -f markdown \ | 17 | if [ "${1#*.}" = "md" ]; then |
18 | -t html5 \ | 18 | echo "[COMPILE] $1 -> $TARGET" |
19 | --template templates/base.html \ | 19 | |
20 | -o "$TARGET" \ | 20 | pandoc "$1" \ |
21 | --metadata sitetitle="$SITE_TITLE" | 21 | -f markdown \ |
22 | -t html5 \ | ||
23 | --template templates/base.html \ | ||
24 | -o "$TARGET" \ | ||
25 | --metadata sitetitle="$SITE_TITLE" | ||
26 | else | ||
27 | echo "[COPY ] $1 -> $TARGET" | ||
28 | |||
29 | cp "$1" "$TARGET" | ||
30 | fi | ||
22 | } | 31 | } |
23 | 32 | ||
24 | if [ -z "$1" ]; then | 33 | if [ -z "$1" ]; then |
25 | find content/ \ | 34 | find content/ \ |
26 | -iname "*.md" \ | ||
27 | -type f \ | 35 | -type f \ |
28 | | while read FILE | 36 | | while read FILE |
29 | do | 37 | do |
30 | compile "$FILE" | 38 | handle "$FILE" |
31 | done | 39 | done |
32 | elif [ "$2" = "delete" ]; then | 40 | elif [ "$2" = "delete" ]; then |
33 | rm -rf $(target $1) | 41 | TARGET=$(target "$1") |
42 | echo "[DELETE] $1 -> $TARGET" | ||
43 | rm -rf $TARGET | ||
34 | else | 44 | else |
35 | compile "$1" | 45 | handle "$1" |
36 | fi | 46 | fi |
diff --git a/scripts/watch_content.sh b/scripts/watch_content.sh index 60f7b07..c4f55fb 100755 --- a/scripts/watch_content.sh +++ b/scripts/watch_content.sh | |||
@@ -1,9 +1,8 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | inotifywait -rme create,close_write,delete,move --format "%w%f" content \ | 3 | inotifywait -qrme close_write,delete,move --format "%w%f" content \ |
4 | | while read FILENAME | 4 | | while read FILENAME |
5 | do | 5 | do |
6 | printf "Change detected: %s\n" "$FILENAME" | ||
7 | if [ -f "$FILENAME" ]; then | 6 | if [ -f "$FILENAME" ]; then |
8 | scripts/build_content.sh "$FILENAME" | 7 | scripts/build_content.sh "$FILENAME" |
9 | elif [ ! -d "$FILENAME" ]; then | 8 | elif [ ! -d "$FILENAME" ]; then |
diff --git a/scripts/watch_sass.sh b/scripts/watch_sass.sh index 97fd207..a5649e7 100755 --- a/scripts/watch_sass.sh +++ b/scripts/watch_sass.sh | |||
@@ -1,8 +1,7 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | inotifywait -rme create,close_write,delete,move --format "%w%f" assets \ | 3 | inotifywait -qrme close_write,delete,move --format "%w%f" assets \ |
4 | | while read FILENAME | 4 | | while read FILENAME |
5 | do | 5 | do |
6 | printf "Change detected: %s\n" "$FILENAME" | ||
7 | scripts/build_sass.sh | 6 | scripts/build_sass.sh |
8 | done | 7 | done |