summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2020-12-26 09:52:34 +0100
committerVolpeon <git@volpeon.ink>2020-12-26 09:52:34 +0100
commit15147ca676f7f77697889b65721540f8b8a813ab (patch)
tree563902c127d644f0f58fd26a901794c585d9c993
parentImproved CSS definitions, more fine-grained content build script (diff)
downloadvolpeon.ink-15147ca676f7f77697889b65721540f8b8a813ab.tar.gz
volpeon.ink-15147ca676f7f77697889b65721540f8b8a813ab.tar.bz2
volpeon.ink-15147ca676f7f77697889b65721540f8b8a813ab.zip
Generate precompressed files, use variables for some nav-related values
-rw-r--r--Makefile23
-rw-r--r--assets/css/_vars.scss5
-rw-r--r--assets/css/components/_nav.scss8
-rwxr-xr-xscripts/build_content.sh12
-rwxr-xr-xscripts/build_fonts.sh4
-rwxr-xr-xscripts/build_sass.sh2
-rw-r--r--templates/base.html3
7 files changed, 37 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index 5a00cdc..caf9939 100644
--- a/Makefile
+++ b/Makefile
@@ -13,24 +13,33 @@ build_sass: clean
13build_content: clean 13build_content: clean
14 @scripts/build_content.sh 14 @scripts/build_content.sh
15 15
16build: build_fonts build_sass build_content 16build_only: build_fonts build_sass build_content
17# @pigz -R -k -9 -- `find output -type f -iregex '.*\\.\\(css\\|js\\|json\\|html\\|xml\\|txt\\|svg\\|ico\\)'`
18 17
19watch_sass: build 18compress_gz: build_only
19 @echo "[COMPRESS] Gzip"
20 @pigz -R -k -9 -- `find output -type f -iregex '.*\\.\\(css\\|js\\|json\\|html\\|xml\\|txt\\|svg\\|ico\\)'`
21
22compress_br: build_only
23 @echo "[COMPRESS] Brotli"
24 @brotli -k -- `find output -type f -iregex '.*\\.\\(css\\|js\\|json\\|html\\|xml\\|txt\\|svg\\|ico\\|woff\\)'`
25
26build: compress_gz compress_br
27
28watch_sass: build_only
20 @scripts/watch_sass.sh 29 @scripts/watch_sass.sh
21 30
22watch_content: build 31watch_content: build_only
23 @scripts/watch_content.sh 32 @scripts/watch_content.sh
24 33
25watch_templates: build 34watch_templates: build_only
26 @scripts/watch_templates.sh 35 @scripts/watch_templates.sh
27 36
28watch_metadata: build 37watch_metadata: build_only
29 @scripts/watch_metadata.sh 38 @scripts/watch_metadata.sh
30 39
31watch: watch_sass watch_content watch_templates watch_metadata 40watch: watch_sass watch_content watch_templates watch_metadata
32 41
33serve_only: build 42serve_only: build_only
34 @python -m http.server --bind 127.0.0.1 --directory output 43 @python -m http.server --bind 127.0.0.1 --directory output
35 44
36serve: watch serve_only 45serve: watch serve_only
diff --git a/assets/css/_vars.scss b/assets/css/_vars.scss
index 1ed64a5..f9c80da 100644
--- a/assets/css/_vars.scss
+++ b/assets/css/_vars.scss
@@ -7,6 +7,11 @@ $code-block-line-height: 1.4;
7 7
8$content-width: 75ch; 8$content-width: 75ch;
9 9
10$nav-item-spacing: 4ch;
11$nav-item-spacing-sm: 3ch;
12$nav-item-pad-h: 1ch;
13$nav-item-pad-v: 1rem;
14
10$page-item-prefix-max-chars: 3ch; 15$page-item-prefix-max-chars: 3ch;
11$page-item-prefix-pad: 2ch; 16$page-item-prefix-pad: 2ch;
12$page-item-prefix-width: $page-item-prefix-max-chars + $page-item-prefix-pad; 17$page-item-prefix-width: $page-item-prefix-max-chars + $page-item-prefix-pad;
diff --git a/assets/css/components/_nav.scss b/assets/css/components/_nav.scss
index 834b6a0..a85c7d8 100644
--- a/assets/css/components/_nav.scss
+++ b/assets/css/components/_nav.scss
@@ -8,6 +8,8 @@
8 8
9 &__logo { 9 &__logo {
10 display: inline-block; 10 display: inline-block;
11 margin: 0;
12 padding: $nav-item-pad-v 0;
11 color: var(--nav-logo-fg); 13 color: var(--nav-logo-fg);
12 text-decoration: none; 14 text-decoration: none;
13 15
@@ -23,8 +25,8 @@
23 25
24 &__item { 26 &__item {
25 display: inline-block; 27 display: inline-block;
26 padding: 1rem 1ch calc(1rem - 2px); 28 padding: $nav-item-pad-v $nav-item-pad-h calc(#{$nav-item-pad-v} - 2px);
27 margin: 0 -1ch 0 3ch; 29 margin: 0 (-1 * $nav-item-pad-h) 0 ($nav-item-spacing - $nav-item-pad-h);
28 color: var(--nav-item-idle-fg); 30 color: var(--nav-item-idle-fg);
29 text-decoration: none; 31 text-decoration: none;
30 border-bottom: 2px solid transparent; 32 border-bottom: 2px solid transparent;
@@ -38,7 +40,7 @@
38 40
39 @media (max-width: map-get($breakpoints, "sm")) { 41 @media (max-width: map-get($breakpoints, "sm")) {
40 &__item { 42 &__item {
41 margin-left: 2ch; 43 margin-left: $nav-item-spacing-sm - $nav-item-pad-h;
42 } 44 }
43 } 45 }
44 46
diff --git a/scripts/build_content.sh b/scripts/build_content.sh
index 6ce857f..9623427 100755
--- a/scripts/build_content.sh
+++ b/scripts/build_content.sh
@@ -13,7 +13,7 @@ handle () {
13 mkdir -p $(dirname "$TARGET") 13 mkdir -p $(dirname "$TARGET")
14 14
15 if [ "${1#*.}" = "md" ]; then 15 if [ "${1#*.}" = "md" ]; then
16 echo "[COMPILE] $1 -> $TARGET" 16 echo "[COMPILE ] $1 -> $TARGET"
17 17
18 pandoc "$1" \ 18 pandoc "$1" \
19 -f markdown \ 19 -f markdown \
@@ -22,7 +22,7 @@ handle () {
22 -o "$TARGET" \ 22 -o "$TARGET" \
23 --metadata-file metadata/metadata.json 23 --metadata-file metadata/metadata.json
24 else 24 else
25 echo "[COPY ] $1 -> $TARGET" 25 echo "[ COPY ] $1 -> $TARGET"
26 26
27 cp "$1" "$TARGET" 27 cp "$1" "$TARGET"
28 fi 28 fi
@@ -45,18 +45,18 @@ elif [ "$1" = "md" ]; then
45 done 45 done
46elif [ "$1" = "single" ]; then 46elif [ "$1" = "single" ]; then
47 if [ -z "$2" ]; then 47 if [ -z "$2" ]; then
48 echo "[ERROR ] \"single\" operation requires file argument" 48 echo "[ ERROR ] \"single\" operation requires file argument"
49 else 49 else
50 handle "$2" 50 handle "$2"
51 fi 51 fi
52elif [ "$1" = "delete" ]; then 52elif [ "$1" = "delete" ]; then
53 if [ -z "$2" ]; then 53 if [ -z "$2" ]; then
54 echo "[ERROR ] \"delete\" operation requires file argument" 54 echo "[ ERROR ] \"delete\" operation requires file argument"
55 else 55 else
56 TARGET=$(target "$2") 56 TARGET=$(target "$2")
57 echo "[DELETE ] $2 -> $TARGET" 57 echo "[ DELETE ] $2 -> $TARGET"
58 rm -rf $TARGET 58 rm -rf $TARGET
59 fi 59 fi
60else 60else
61 echo "[ERROR ] Unknown operation: \"$1\"" 61 echo "[ ERROR ] Unknown operation: \"$1\""
62fi 62fi
diff --git a/scripts/build_fonts.sh b/scripts/build_fonts.sh
index 11c01db..d8ed9ea 100755
--- a/scripts/build_fonts.sh
+++ b/scripts/build_fonts.sh
@@ -1,6 +1,6 @@
1#!/bin/bash 1#!/bin/bash
2 2
3echo "[MINIFY ] assets/fonts/iosevka-term-ss09-regular.ttf -> output/iosevka-term-ss09-regular.woff2" 3echo "[ MINIFY ] assets/fonts/iosevka-term-ss09-regular.ttf -> output/iosevka-term-ss09-regular.woff2"
4 4
5pyftsubset assets/fonts/iosevka-term-ss09-regular.ttf \ 5pyftsubset assets/fonts/iosevka-term-ss09-regular.ttf \
6 --text-file='assets/fonts/glyphs.txt' \ 6 --text-file='assets/fonts/glyphs.txt' \
@@ -8,7 +8,7 @@ pyftsubset assets/fonts/iosevka-term-ss09-regular.ttf \
8 --flavor='woff2' \ 8 --flavor='woff2' \
9 --output-file='output/iosevka-term-ss09-regular.woff2' 9 --output-file='output/iosevka-term-ss09-regular.woff2'
10 10
11echo "[MINIFY ] assets/fonts/iosevka-term-ss09-bold.ttf -> output/iosevka-term-ss09-bold.woff2" 11echo "[ MINIFY ] assets/fonts/iosevka-term-ss09-bold.ttf -> output/iosevka-term-ss09-bold.woff2"
12 12
13pyftsubset assets/fonts/iosevka-term-ss09-bold.ttf \ 13pyftsubset assets/fonts/iosevka-term-ss09-bold.ttf \
14 --text-file='assets/fonts/glyphs.txt' \ 14 --text-file='assets/fonts/glyphs.txt' \
diff --git a/scripts/build_sass.sh b/scripts/build_sass.sh
index 2e25f10..2711a89 100755
--- a/scripts/build_sass.sh
+++ b/scripts/build_sass.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/bash
2 2
3echo "[COMPILE] assets/css/style.scss -> output/style.css" 3echo "[COMPILE ] assets/css/style.scss -> output/style.css"
4sassc assets/css/style.scss | node_modules/.bin/csso > output/style.css 4sassc assets/css/style.scss | node_modules/.bin/csso > output/style.css
diff --git a/templates/base.html b/templates/base.html
index d381984..cecb657 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -41,7 +41,7 @@
41 <main class="s-page l-container l-container--content l-container--pad-v"> 41 <main class="s-page l-container l-container--content l-container--pad-v">
42 <div class="s-page__content"> 42 <div class="s-page__content">
43 $if(isHome)$ 43 $if(isHome)$
44 <header class="c-page-header" role="presentation"> 44 <header class="c-page-header u-hidden@sm-down" role="presentation">
45${pageHeader()} 45${pageHeader()}
46 </header> 46 </header>
47 $endif$ 47 $endif$
@@ -60,6 +60,7 @@ ${pageHeaderSm()}
60 var headerTemplateEl = document.getElementById("header-sm"); 60 var headerTemplateEl = document.getElementById("header-sm");
61 var headerSmEl = headerTemplateEl.content.cloneNode("true"); 61 var headerSmEl = headerTemplateEl.content.cloneNode("true");
62 62
63 headerEl.classList.remove("u-hidden@sm-down");
63 headerEl.appendChild(headerSmEl); 64 headerEl.appendChild(headerSmEl);
64 </script> 65 </script>
65 $endif$ 66 $endif$