From 8dedec6cef5d61e8c8bb90148a6868ea4039d2cd Mon Sep 17 00:00:00 2001 From: Altagos Date: Fri, 19 Jun 2026 21:24:10 +0200 Subject: [PATCH] update pagefind --- build.zig | 11 +++------ content/notes/markdown-overview/foo.zig | 24 +++++++++++++------- layouts/index.shtml | 13 +++-------- layouts/templates/root.shtml | 4 ++-- mise.toml | 8 +++---- style/content/pagefind.scss | 30 ++++--------------------- 6 files changed, 32 insertions(+), 58 deletions(-) diff --git a/build.zig b/build.zig index d96c081..dd0e771 100644 --- a/build.zig +++ b/build.zig @@ -4,12 +4,6 @@ const zine = @import("zine"); pub fn build(b: *std.Build) !void { const drafts = b.option(bool, "drafts", "Build drafts") orelse false; - // Workaround for Zine's early return bug on macOS due to lazy dependencies - const zine_dep = b.dependencyFromBuildZig(zine, .{}); - if (zine_dep.builder.install_tls.step.dependencies.items.len == 0) { - return; - } - const compile_stylesheet = b.step("stylesheet", "Compile stylesheet from scss files"); const compile_stylesheet_cmd_out = b.run(&.{ "sass", @@ -40,12 +34,13 @@ pub fn build(b: *std.Build) !void { .force = true, }); website.step.dependOn(&install_stylesheet.step); - + website.addPassthruArgs(); if (drafts) { website.addArg("--drafts"); } - b.getInstallStep().dependOn(&website.step); + const dist = b.step("dist", "Build the website for production"); + dist.dependOn(&website.step); const serve = b.step("serve", "Start the Zine dev server"); const run_zine = zine.serve(b, .{ diff --git a/content/notes/markdown-overview/foo.zig b/content/notes/markdown-overview/foo.zig index 47f3715..dd0e771 100644 --- a/content/notes/markdown-overview/foo.zig +++ b/content/notes/markdown-overview/foo.zig @@ -2,15 +2,15 @@ const std = @import("std"); const zine = @import("zine"); pub fn build(b: *std.Build) !void { - const compile_stylesheet = b.step("stylesheet", "Compile altagos.css stylesheet from scss files"); - compile_stylesheet.result_cached = false; - std.debug.assert(try compile_stylesheet.addDirectoryWatchInput(b.path("style"))); + const drafts = b.option(bool, "drafts", "Build drafts") orelse false; + const compile_stylesheet = b.step("stylesheet", "Compile stylesheet from scss files"); const compile_stylesheet_cmd_out = b.run(&.{ "sass", "--no-source-map", "--no-color", - "style/index.scss", + "--load-path=./style", + "./style/index.scss", }); const compile_stylesheet_cmd = b.addWriteFile("altagos.css", compile_stylesheet_cmd_out); const install_stylesheet = b.addInstallDirectory(.{ @@ -29,17 +29,25 @@ pub fn build(b: *std.Build) !void { compile_stylesheet.dependOn(&install_stylesheet.step); const website = zine.website(b, .{ - .install_path = "website", + .output_path = "website", .build_assets = &.{stylesheet}, + .force = true, }); - website.step.dependOn(compile_stylesheet); - b.getInstallStep().dependOn(&website.step); + website.step.dependOn(&install_stylesheet.step); + website.addPassthruArgs(); + if (drafts) { + website.addArg("--drafts"); + } + + const dist = b.step("dist", "Build the website for production"); + dist.dependOn(&website.step); const serve = b.step("serve", "Start the Zine dev server"); const run_zine = zine.serve(b, .{ .build_assets = &.{stylesheet}, - // .debug = .{ .scopes = &.{"serve"} }, }); run_zine.step.dependOn(&install_stylesheet.step); + run_zine.addPassthruArgs(); + serve.dependOn(&run_zine.step); } diff --git a/layouts/index.shtml b/layouts/index.shtml index 75b8a7b..663834b 100644 --- a/layouts/index.shtml +++ b/layouts/index.shtml @@ -1,18 +1,11 @@ - -

- - - - +
  • diff --git a/layouts/templates/root.shtml b/layouts/templates/root.shtml index 4962355..d52412b 100644 --- a/layouts/templates/root.shtml +++ b/layouts/templates/root.shtml @@ -67,8 +67,8 @@
    - - + +
    diff --git a/mise.toml b/mise.toml index fee4fb4..9fd5fe2 100644 --- a/mise.toml +++ b/mise.toml @@ -1,5 +1,5 @@ [tools] -deno = "latest" +npm = "latest" "github:sass/dart-sass" = "latest" watchexec = "latest" zig = "master" @@ -8,16 +8,16 @@ zig = "master" run = "watchexec -q -r -e scss,zig 'zig build serve -- --drafts'" [tasks.watch-index] -run = "watchexec -q -r -e scss,zig,shtml,smd 'zig build -Ddrafts; and deno run --allow-env --allow-run npm:pagefind --site zig-out/website --serve'" +run = "watchexec -q -r -e scss,zig,shtml,smd 'zig build dist -Ddrafts; and npx pagefind --site zig-out/website --serve'" [tasks.dev] run = "zig build serve -- --drafts" [tasks.create-index] -run = "deno run --allow-env --allow-run npm:pagefind --site zig-out/website" +run = "npx pagefind --site zig-out/website" [tasks.dist] -run = "zig build --color off --summary all --verbose" +run = "zig build dist --color off --summary all --verbose" depends_post = "create-index" [tasks.clean] diff --git a/style/content/pagefind.scss b/style/content/pagefind.scss index a4485dd..c632cc9 100644 --- a/style/content/pagefind.scss +++ b/style/content/pagefind.scss @@ -1,28 +1,6 @@ -#search { - --pagefind-ui-scale: 0.8; - --pagefind-ui-primary: var(--primary); - --pagefind-ui-text: var(--fg); - --pagefind-ui-background: var(--bg-m3); - --pagefind-ui-border: var(--bg-m3); - --pagefind-ui-tag: var(--bg-m3); - --pagefind-ui-border-width: 2px; - --pagefind-ui-border-radius: 8px; - --pagefind-ui-image-border-radius: 8px; - --pagefind-ui-image-box-ratio: 3 / 2; - --pagefind-ui-font: "Andada Pro"; +pagefind-searchbox { + --pf-searchbox-max-width: 100%; - margin-bottom: 1.5em; -} - -.pagefind-ui__search-input { - &:focus { - outline: unset; - } -} - -.pagefind-ui__drawer { - flex-direction: column !important; - flex-wrap: unset !important; - gap: 0 !important; - justify-content: start !important; + --pf-border: var(--bg-p1); + --pf-outline-focus: var(--diag-hint); } -- knotmirror 0.0.1