From 624b609ef96c3e2ac9d20fde6e512bae371abd37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Mon, 2 Sep 2024 22:35:23 +0200 Subject: [PATCH] feat: replace xeiaso custom font with 0xProto --- flake.nix | 38 +++++++++++++++++++++++++++++++++----- pkg/app/template.templ | 1 - static/.gitignore | 2 ++ static/embed.go | 2 +- static/style.css | 30 ++++++++++++++++++++++-------- tailwind.config.js | 10 +++++----- 6 files changed, 63 insertions(+), 20 deletions(-) diff --git a/flake.nix b/flake.nix index e8fb8ca..6902b9d 100644 --- a/flake.nix +++ b/flake.nix @@ -11,6 +11,31 @@ let pkgs = import inputs.nixpkgs { inherit system; }; + mkWOFF2From = + name: pkg: ext: + pkgs.stdenvNoCC.mkDerivation { + name = "${name}-woff2"; + nativeBuildInputs = [ + pkgs.fontforge + pkg + ]; + dontInstall = true; + unpackPhase = '' + WOFF2_DIR="$out/share/fonts/woff2/" + mkdir -p "$WOFF2_DIR" + for file in ${pkg}/share/fonts/truetype/*.${ext}; do + NAME="$(basename $file .${ext})" + fontforge --lang=ff \ + -c 'Open($1); Generate($2);' \ + "$file" \ + "$WOFF2_DIR/$NAME.woff2" & + done + wait + ''; + }; + + iosevka-comfy-woff2 = mkWOFF2From "iosevka-comfy-fixed" pkgs.iosevka-comfy.comfy-fixed "ttf"; + rundev = pkgs.writeShellApplication { name = "rundev"; runtimeInputs = [ @@ -19,15 +44,16 @@ (pkgs.writeShellApplication { name = "buildapp"; text = '' - tailwindcss -i static/style.css -o static/generated.css && \ - templ generate && \ - go build && \ - ./app + function buildapp() { + ${self.defaultPackage.${system}.preBuild} + go build + } + buildapp && ./app ''; }) ]; text = '' - if [ -z "$1" ]; then + if [ $# -eq 0 ]; then buildapp elif [ "$1" = "--watch" ]; then fd | entr -c -r buildapp @@ -58,6 +84,8 @@ makeWrapper ]; preBuild = '' + install -D ${iosevka-comfy-woff2}/share/fonts/woff2/iosevka-comfy-fixed-regular.woff2 static/ + install -D ${iosevka-comfy-woff2}/share/fonts/woff2/iosevka-comfy-fixed-bold.woff2 static/ templ generate tailwindcss -i static/style.css -o static/generated.css ''; diff --git a/pkg/app/template.templ b/pkg/app/template.templ index 8c57083..b564c4e 100644 --- a/pkg/app/template.templ +++ b/pkg/app/template.templ @@ -18,7 +18,6 @@ templ (app *Server) Template(body templ.Component) { drawbu - code { - @apply bg-gray-200 px-1; + @apply bg-gray-200 px-1 } #article blockquote > p { - @apply ml-4 flex flex-col text-gray-500; + @apply ml-4 flex flex-col text-gray-500 } diff --git a/tailwind.config.js b/tailwind.config.js index 4e45c2f..cbab8f6 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -4,11 +4,11 @@ module.exports = { theme: { extend: {}, fontFamily: { - body: ['Iosevka Aile Iaso', 'sans-serif'], - display: ['Iosevka Aile Iaso', 'sans-serif'], - mono: ['Iosevka Aile Iaso', 'sans-serif'], - sans: ['Iosevka Aile Iaso', 'sans-serif'], - serif: ['Iosevka Aile Iaso', 'sans-serif'], + body: ['Iosevka Comfy', 'sans-serif'], + display: ['Iosevka Comfy', 'sans-serif'], + mono: ['Iosevka Comfy', 'sans-serif'], + sans: ['Iosevka Comfy', 'sans-serif'], + serif: ['Iosevka Comfy', 'sans-serif'], }, },