From 714d8f7ff8425e4177ff6bde4d214ef75be6b1ab Mon Sep 17 00:00:00 2001 From: Volpeon Date: Thu, 24 Dec 2020 15:05:32 +0100 Subject: Added header, improved SCSS structure, use metadata file instead of param, improved folder structure --- Makefile | 16 +- assets/css/_basics.scss | 172 ++++++++++++++ assets/css/_functions.scss | 12 + assets/css/_utils.scss | 15 ++ assets/css/_vars.scss | 43 ++++ assets/css/components/_nav.scss | 14 ++ assets/css/components/_page-header.scss | 17 ++ assets/css/components/_refs.scss | 7 + assets/css/scopes/_page.scss | 93 ++++++++ assets/css/style.scss | 11 + assets/fonts/glyphs.txt | 1 + assets/fonts/iosevka-term-ss09-bold.ttf | Bin 0 -> 1557444 bytes assets/fonts/iosevka-term-ss09-regular.ttf | Bin 0 -> 1541132 bytes assets/glyphs.txt | 1 - assets/iosevka-term-ss09-bold.ttf | Bin 1557444 -> 0 bytes assets/iosevka-term-ss09-regular.ttf | Bin 1541132 -> 0 bytes assets/style.scss | 352 ----------------------------- content/blog/index.md | 6 + content/index.md | 10 +- metadata/metadata.json | 17 ++ postcss.config.js | 7 - scripts/build_content.sh | 4 +- scripts/build_fonts.sh | 17 ++ scripts/build_sass.sh | 4 +- scripts/watch_metadata.sh | 7 + templates/base.html | 28 ++- templates/pageHeader.html | 2 +- templates/pageHeaderSm.html | 2 +- 28 files changed, 467 insertions(+), 391 deletions(-) create mode 100644 assets/css/_basics.scss create mode 100644 assets/css/_functions.scss create mode 100644 assets/css/_utils.scss create mode 100644 assets/css/_vars.scss create mode 100644 assets/css/components/_nav.scss create mode 100644 assets/css/components/_page-header.scss create mode 100644 assets/css/components/_refs.scss create mode 100644 assets/css/scopes/_page.scss create mode 100644 assets/css/style.scss create mode 100644 assets/fonts/glyphs.txt create mode 100644 assets/fonts/iosevka-term-ss09-bold.ttf create mode 100644 assets/fonts/iosevka-term-ss09-regular.ttf delete mode 100644 assets/glyphs.txt delete mode 100644 assets/iosevka-term-ss09-bold.ttf delete mode 100644 assets/iosevka-term-ss09-regular.ttf delete mode 100644 assets/style.scss create mode 100644 content/blog/index.md create mode 100644 metadata/metadata.json delete mode 100644 postcss.config.js create mode 100755 scripts/build_fonts.sh create mode 100755 scripts/watch_metadata.sh diff --git a/Makefile b/Makefile index c9d0cf8..5a00cdc 100644 --- a/Makefile +++ b/Makefile @@ -5,16 +5,7 @@ clean: @rm -rf output/* build_fonts: clean - @pyftsubset assets/iosevka-term-ss09-regular.ttf \ - --text-file='assets/glyphs.txt' \ - --layout-features+=ss09,dlig \ - --flavor='woff2' \ - --output-file='output/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='output/iosevka-term-ss09-bold.woff2' + @scripts/build_fonts.sh build_sass: clean @scripts/build_sass.sh @@ -34,7 +25,10 @@ watch_content: build watch_templates: build @scripts/watch_templates.sh -watch: watch_sass watch_content watch_templates +watch_metadata: build + @scripts/watch_metadata.sh + +watch: watch_sass watch_content watch_templates watch_metadata serve_only: build @python -m http.server --bind 127.0.0.1 --directory output diff --git a/assets/css/_basics.scss b/assets/css/_basics.scss new file mode 100644 index 0000000..3adf64c --- /dev/null +++ b/assets/css/_basics.scss @@ -0,0 +1,172 @@ +@font-face { + font-family: "Iosevka Term SS09"; + font-style: normal; + font-weight: normal; + src: url("/iosevka-term-ss09-regular.woff2") format("woff2"); +} + +@font-face { + font-family: "Iosevka Term SS09"; + font-style: normal; + font-weight: bold; + src: url("/iosevka-term-ss09-bold.woff2") format("woff2"); +} + +::selection { + color: var(--select-fg); + background-color: var(--select-bg); +} + +html, +pre, +code { + font-family: "Iosevka Term SS09", "Lucida Console", "Courier New", Courier, + monospace; + font-feature-settings: "calt" 0, "dlig" 1; +} + +html { + font-size: px-to-em($font-size, 16px); + line-height: $line-height; + background-color: var(--bg); + color: var(--fg); +} + +body { + margin: 2em; + padding: 0; + + @media (max-width: $breakpoint-sm) { + margin: 1em; + } +} + +main { + max-width: 70ch; + margin: 0 auto; +} + +code { + color: var(--code-fg); +} + +pre { + margin: 0; + color: var(--code-block-fg); + font-size: $code-block-font-size; + line-height: $code-block-line-height; + + strong { + font-weight: normal; + } +} + +strong { + color: var(--fg-plus); + font-weight: bold; +} + +ul, +ol { + margin: ($line-height * 1rem) 0 0; + padding: 0; + list-style: none; +} + +li { + position: relative; + padding-left: $subcontent-indent; + + &::before { + position: absolute; + display: inline-block; + width: $subcontent-indent; + margin-left: -1 * $subcontent-indent; + color: var(--fg-minus); + } +} + +ul > li::before { + content: "-"; +} + +ol { + counter-reset: cnt; + + > li { + counter-increment: cnt; + + &::before { + content: counter(cnt) "."; + } + } +} + +h1, +h2, +h3 { + margin: ($line-height * 2rem) 0 0; + + + h1, + + h2, + + h3 { + margin-top: $line-height * 1rem; + } +} + +h1 { + text-transform: uppercase; + font-size: px-to-em($heading-font-size); + color: var(--heading); +} + +h2 { + font-size: 1em; + color: var(--heading); +} + +h3 { + font-size: 1em; +} + +p { + margin: ($line-height * 1em) 0 0; + hyphens: auto; +} + +:link, +:visited { + position: relative; + z-index: 1000; + padding: 0.1em 0.3em; + margin: 0 -0.3em; + color: var(--link-idle-fg); + + &:hover { + background-color: var(--link-hover-bg); + color: var(--link-hover-fg); + text-decoration: none; + } +} + +:visited { + color: var(--link-visited-fg); +} + +hr { + height: 1px; + margin: ($line-height * 2rem) 0 ($line-height * 2rem); + background-color: var(--bg-plus); + border: 0; + + @media (max-width: $breakpoint-sm) { + margin-left: 0; + } +} + +blockquote { + position: relative; + margin: ($line-height * 1rem) 0 0; + padding-left: calc(#{$subcontent-indent} - 2px); + border-left: 2px solid var(--bg-plus); +} diff --git a/assets/css/_functions.scss b/assets/css/_functions.scss new file mode 100644 index 0000000..cd8947e --- /dev/null +++ b/assets/css/_functions.scss @@ -0,0 +1,12 @@ +@function px-to-em($s, $b: $font-size) { + @return 1 / ($b / 1px) * ($s / 1px) * 1em; +} + +@function str-repeat($s, $n) { + $r: ""; + @while $n > 0 { + $r: $r + $s; + $n: $n - 1; + } + @return $r; +} diff --git a/assets/css/_utils.scss b/assets/css/_utils.scss new file mode 100644 index 0000000..bf7e213 --- /dev/null +++ b/assets/css/_utils.scss @@ -0,0 +1,15 @@ +.u-hidden { + display: none; + + &\@sm-down { + @media (max-width: $breakpoint-sm) { + display: none; + } + } + + &\@sm-up { + @media (min-width: $breakpoint-sm + 1) { + display: none; + } + } +} diff --git a/assets/css/_vars.scss b/assets/css/_vars.scss new file mode 100644 index 0000000..a29ad6d --- /dev/null +++ b/assets/css/_vars.scss @@ -0,0 +1,43 @@ +$font-size: 17px; +$heading-font-size: $font-size + 1; +$code-block-font-size: $font-size; +$line-height: 1.5; +$code-block-line-height: 1.4; + +$page-item-prefix-max-chars: 3ch; +$page-item-prefix-pad: 2ch; +$page-item-prefix-width: $page-item-prefix-max-chars + $page-item-prefix-pad; + +$subcontent-indent: 4ch; + +$breakpoint-sm: 700px; + +:root { + --gray1: hsl(270, 0%, 9.7%); + --gray2: hsl(270, 1%, 29%); + --gray3: hsl(270, 2%, 54%); + --gray4: hsl(270, 2%, 73%); + --gray5: hsl(270, 2%, 83%); + --gray6: hsl(270, 2%, 100%); + + --bg: var(--gray1); + --bg-plus: var(--gray2); + --fg-minus: var(--gray3); + --fg: var(--gray4); + --fg-plus: var(--gray6); + + --select-bg: hsla(270, 2%, 100%, 0.996); + --select-fg: var(--gray1); + + --code-fg: var(--fg-minus); + --code-block-fg: var(--fg-minus); + + --page-item-prefix-fg: var(--fg-minus); + + --link-idle-fg: var(--gray6); //#90acf2; //var(--gray6); + --link-visited-fg: var(--gray5); //#bc9df2; //var(--gray5); + --link-hover-bg: var(--gray6); + --link-hover-fg: var(--gray1); + + --heading: var(--fg-plus); +} diff --git a/assets/css/components/_nav.scss b/assets/css/components/_nav.scss new file mode 100644 index 0000000..1fc24f9 --- /dev/null +++ b/assets/css/components/_nav.scss @@ -0,0 +1,14 @@ +.c-nav { + margin-bottom: $line-height * 2rem; + + &::before { + content: "//\\"; + color: var(--page-item-prefix-fg); + } + + &__item { + margin-left: 2ch; + color: var(--fg); + text-decoration: none; + } +} diff --git a/assets/css/components/_page-header.scss b/assets/css/components/_page-header.scss new file mode 100644 index 0000000..29eef00 --- /dev/null +++ b/assets/css/components/_page-header.scss @@ -0,0 +1,17 @@ +.c-page-header { + margin-bottom: $line-height * 2rem; + overflow: hidden; + + &::after { + position: relative; + z-index: -10; + content: str-repeat("░", 120); + display: block; + height: $line-height; + margin-top: px-to-em(2px); + padding-top: px-to-em(2px); + color: var(--fg-minus); + border-top: 1px solid var(--fg-minus); + line-height: $code-block-line-height; + } +} diff --git a/assets/css/components/_refs.scss b/assets/css/components/_refs.scss new file mode 100644 index 0000000..b90252d --- /dev/null +++ b/assets/css/components/_refs.scss @@ -0,0 +1,7 @@ +.c-refs__item { + padding-left: 0; + + &::before { + display: none; + } +} diff --git a/assets/css/scopes/_page.scss b/assets/css/scopes/_page.scss new file mode 100644 index 0000000..cf7673c --- /dev/null +++ b/assets/css/scopes/_page.scss @@ -0,0 +1,93 @@ +.s-page { + padding-left: $page-item-prefix-width; + + h1, + h2, + h3, + .c-refs__item, + pre { + position: relative; + margin-left: -1 * $page-item-prefix-width; + padding-left: $page-item-prefix-width; + + &::before { + position: absolute; + box-sizing: border-box; + display: inline-block; + margin-left: -1 * $page-item-prefix-width; + padding-right: $page-item-prefix-pad; + width: $page-item-prefix-width; + color: var(--page-item-prefix-fg); + font-size: 1rem; + font-weight: normal; + text-align: right; + } + + @media (max-width: $breakpoint-sm) { + margin-left: 0; + padding-left: 0; + + &::before { + display: none; + } + } + } + + h1::before { + content: "#"; + } + + h2::before { + content: "##"; + } + + h3::before { + content: "###"; + } + + .c-refs__item::before { + content: "|>"; + } + + pre::before { + content: str-repeat("``\A", 40); + height: 100%; + color: var(--page-item-prefix-fg); + overflow: hidden; + line-height: $code-block-line-height * ($code-block-font-size / $font-size); + } + + hr { + margin-left: -1 * $page-item-prefix-width; + } + + .c-page-header { + margin-left: -1 * $page-item-prefix-width; + padding-left: $page-item-prefix-width; + + &::after { + margin-left: -1 * $page-item-prefix-width; + } + + @media (max-width: $breakpoint-sm) { + margin-left: 0; + padding-left: 0; + + &::after { + margin-left: 0; + } + } + } + + .c-nav { + margin-left: -1 * $page-item-prefix-width; + + @media (max-width: $breakpoint-sm) { + margin-left: 0; + } + } + + @media (max-width: $breakpoint-sm) { + padding-left: 0; + } +} diff --git a/assets/css/style.scss b/assets/css/style.scss new file mode 100644 index 0000000..7383ac4 --- /dev/null +++ b/assets/css/style.scss @@ -0,0 +1,11 @@ +@import "vars"; +@import "functions"; +@import "basics"; + +@import "components/refs"; +@import "components/nav"; +@import "components/page-header"; + +@import "scopes/page"; + +@import "utils"; diff --git a/assets/fonts/glyphs.txt b/assets/fonts/glyphs.txt new file mode 100644 index 0000000..ac0461a --- /dev/null +++ b/assets/fonts/glyphs.txt @@ -0,0 +1 @@ + !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`´abcdefghijklmnopqrstuvwxyz{|}~äöüÄÖÜßẞ↓↙←↖↑↗→↘€»«„“”·…°’‾█▓▒░ ▀▄‐╭╮─│╰╯┌┐└┘├╱╲╳ʻ‘ diff --git a/assets/fonts/iosevka-term-ss09-bold.ttf b/assets/fonts/iosevka-term-ss09-bold.ttf new file mode 100644 index 0000000..85915cf Binary files /dev/null and b/assets/fonts/iosevka-term-ss09-bold.ttf differ diff --git a/assets/fonts/iosevka-term-ss09-regular.ttf b/assets/fonts/iosevka-term-ss09-regular.ttf new file mode 100644 index 0000000..83ddee6 Binary files /dev/null and b/assets/fonts/iosevka-term-ss09-regular.ttf differ diff --git a/assets/glyphs.txt b/assets/glyphs.txt deleted file mode 100644 index ac0461a..0000000 --- a/assets/glyphs.txt +++ /dev/null @@ -1 +0,0 @@ - !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`´abcdefghijklmnopqrstuvwxyz{|}~äöüÄÖÜßẞ↓↙←↖↑↗→↘€»«„“”·…°’‾█▓▒░ ▀▄‐╭╮─│╰╯┌┐└┘├╱╲╳ʻ‘ diff --git a/assets/iosevka-term-ss09-bold.ttf b/assets/iosevka-term-ss09-bold.ttf deleted file mode 100644 index 85915cf..0000000 Binary files a/assets/iosevka-term-ss09-bold.ttf and /dev/null differ diff --git a/assets/iosevka-term-ss09-regular.ttf b/assets/iosevka-term-ss09-regular.ttf deleted file mode 100644 index 83ddee6..0000000 Binary files a/assets/iosevka-term-ss09-regular.ttf and /dev/null differ diff --git a/assets/style.scss b/assets/style.scss deleted file mode 100644 index 40b18f5..0000000 --- a/assets/style.scss +++ /dev/null @@ -1,352 +0,0 @@ -$font-size: 18px; -$heading-font-size: $font-size + 1; -$code-block-font-size: $font-size - 1; -$line-height: 1.5; - -$page-item-prefix-max-chars: 3ch; -$page-item-prefix-pad: 2ch; -$page-item-prefix-width: $page-item-prefix-max-chars + $page-item-prefix-pad; - -$subcontent-indent: 4ch; - -$breakpoint-sm: 700px; - -@function px-to-em($s, $b: $font-size) { - @return 1 / ($b / 1px) * ($s / 1px) * 1em; -} - -@function str-repeat($s, $n) { - $r: ""; - @while $n > 0 { - $r: $r + $s; - $n: $n - 1; - } - @return $r; -} - -@font-face { - font-family: "Iosevka Term SS09"; - font-style: normal; - font-weight: normal; - src: url("/iosevka-term-ss09-regular.woff2") format("woff2"); -} - -@font-face { - font-family: "Iosevka Term SS09"; - font-style: normal; - font-weight: bold; - src: url("/iosevka-term-ss09-bold.woff2") format("woff2"); -} - -:root { - --gray1: hsl(270, 0%, 9.7%); - --gray2: hsl(270, 1%, 29%); - --gray3: hsl(270, 2%, 54%); - --gray4: hsl(270, 2%, 73%); - --gray5: hsl(270, 2%, 83%); - --gray6: hsl(270, 2%, 100%); - - --bg: var(--gray1); - --bg-plus: var(--gray2); - --fg-minus: var(--gray3); - --fg: var(--gray4); - --fg-plus: var(--gray6); - - --select-bg: hsla(270, 2%, 100%, 0.996); - --select-fg: var(--gray1); - - --code-fg: var(--fg-minus); - --code-block-fg: var(--fg-minus); - - --page-item-prefix-fg: var(--fg-minus); - - --link-idle-fg: var(--gray6); //#90acf2; //var(--gray6); - --link-visited-fg: var(--gray5); //#bc9df2; //var(--gray5); - --link-hover-bg: var(--gray6); - --link-hover-fg: var(--gray1); - - --heading: var(--fg-plus); -} - -::selection { - color: var(--select-fg); - background-color: var(--select-bg); -} - -html, -pre, -code { - font-family: "Iosevka Term SS09", "Lucida Console", "Courier New", Courier, - monospace; - font-feature-settings: "calt" 0, "dlig" 1; -} - -html { - font-size: px-to-em($font-size, 16px); - line-height: $line-height; - background-color: var(--bg); - color: var(--fg); -} - -body { - margin: 2em; - padding: 0; - - @media (max-width: $breakpoint-sm) { - margin: 1em; - } -} - -main { - max-width: 70ch; - margin: 0 auto; -} - -code { - color: var(--code-fg); -} - -pre { - margin: 0; - color: var(--code-block-fg); - font-size: $code-block-font-size; - line-height: 1.4; - - strong { - font-weight: normal; - } -} - -strong { - color: var(--fg-plus); - font-weight: bold; -} - -ul, -ol { - margin: ($line-height * 1rem) 0 0; - padding: 0; - list-style: none; - - > li { - position: relative; - padding-left: $subcontent-indent; - - &::before { - position: absolute; - display: inline-block; - width: $subcontent-indent; - margin-left: -1 * $subcontent-indent; - color: var(--fg-minus); - } - } -} - -ul { - > li::before { - content: "-"; - } - - &.refs > li { - padding-left: 0; - - &::before { - display: none; - } - } -} - -ol { - counter-reset: cnt; - - > li { - counter-increment: cnt; - - &::before { - content: counter(cnt) "."; - } - } -} - -h1, -h2, -h3 { - margin: ($line-height * 2rem) 0 0; - - + h1, - + h2, - + h3 { - margin-top: $line-height * 1rem; - } -} - -h1 { - text-transform: uppercase; - font-size: px-to-em($heading-font-size); - color: var(--heading); -} - -h2 { - font-size: 1em; - color: var(--heading); -} - -h3 { - font-size: 1em; -} - -p { - margin: ($line-height * 1em) 0 0; -} - -a { - position: relative; - z-index: 1000; - padding: 0.1em 0.3em; - margin: 0 -0.3em; - color: var(--link-idle-fg); - - &:visited { - color: var(--link-visited-fg); - } - - &:hover { - background-color: var(--link-hover-bg); - color: var(--link-hover-fg); - text-decoration: none; - } -} - -hr { - height: 1px; - margin: ($line-height * 2rem) 0 ($line-height * 2rem); - background-color: var(--bg-plus); - border: 0; - - @media (max-width: $breakpoint-sm) { - margin-left: 0; - } -} - -blockquote { - position: relative; - margin: ($line-height * 1rem) 0 0; - padding-left: calc(#{$subcontent-indent} - 2px); - border-left: 2px solid var(--bg-plus); -} - -.c-page-header { - margin-bottom: $line-height * 2rem; - overflow: hidden; - - &::after { - position: relative; - z-index: -10; - content: str-repeat("░", 120); - display: block; - height: $line-height; - margin-top: px-to-em(2px); - padding-top: px-to-em(2px); - color: var(--fg-minus); - border-top: 1px solid var(--fg-minus); - } - - &--sm { - display: none; - } - - @media (max-width: $breakpoint-sm) { - display: none; - - &--sm, - &--nohide { - display: block; - } - } -} - -.s-page { - padding-left: $page-item-prefix-width; - - h1, - h2, - h3, - ul.refs > li, - pre { - position: relative; - margin-left: -1 * $page-item-prefix-width; - padding-left: $page-item-prefix-width; - - &::before { - position: absolute; - box-sizing: border-box; - display: inline-block; - margin-left: -1 * $page-item-prefix-width; - padding-right: $page-item-prefix-pad; - width: $page-item-prefix-width; - color: var(--page-item-prefix-fg); - font-size: 1rem; - font-weight: normal; - text-align: right; - } - - @media (max-width: $breakpoint-sm) { - margin-left: 0; - padding-left: 0; - - &::before { - display: none; - } - } - } - - h1::before { - content: "#"; - } - - h2::before { - content: "##"; - } - - h3::before { - content: "###"; - } - - ul.refs > li::before { - content: "|>"; - } - - pre::before { - content: str-repeat("``\A", 40); - height: 100%; - color: var(--page-item-prefix-fg); - overflow: hidden; - line-height: 1.4 * ($code-block-font-size / $font-size) - } - - hr { - margin-left: -1 * $page-item-prefix-width; - } - - .c-page-header { - margin-left: -1 * $page-item-prefix-width; - padding-left: $page-item-prefix-width; - - &::after { - margin-left: -1 * $page-item-prefix-width; - } - - @media (max-width: $breakpoint-sm) { - margin-left: 0; - padding-left: 0; - - &::after { - margin-left: 0; - } - } - } - - @media (max-width: $breakpoint-sm) { - padding-left: 0; - } -} diff --git a/content/blog/index.md b/content/blog/index.md new file mode 100644 index 0000000..486c57b --- /dev/null +++ b/content/blog/index.md @@ -0,0 +1,6 @@ +--- +id: "blog" +title: "Blog" +--- + +# Blog diff --git a/content/index.md b/content/index.md index f595457..64c3e77 100644 --- a/content/index.md +++ b/content/index.md @@ -1,5 +1,7 @@ --- -title: "Index" +id: "home" +title: "Home" + ismain: true --- @@ -23,7 +25,7 @@ Welcome to my website! I'm Volpeon and here's an [inline link](#). 1. Lorem ipsum dolor sit amet 2. Another item -