Skip to main content

max / balanced_breakfast

Move themes/ and layout.css onto makeover-build Both emitters were byte-identical to GoingsOn's, which is what made them extractable. They live in makeover-build now and this build script calls it, closing makeover-geometry's open question 3. materialize_geometry stays here, because this app selects the touch preset with @media (hover: none) and GoingsOn selects it with a class set by a bootstrap script. Neither is obviously right and a shared crate is the wrong place to settle it silently. build.rs 90 -> 54 lines. Cargo.lock staged as a partial hunk so the unrelated synckit-client lines stay out.
Author: Max Johnson <me@maxj.phd> · 2026-07-28 21:54 UTC
Signed with PGP, not checked
Commit: 6e2ccdb7e305284adb79b56ce340dde6a97b8c04
Parent: 97a4113
3 files changed, +26 insertions, -57 deletions
M Cargo.lock +19 -2
@@ -444,9 +444,9 @@
444 444 "bb-pdf",
445 445 "chrono",
446 446 "futures",
447 - "makeover",
447 + "makeover 2.2.0",
448 + "makeover-build",
448 449 "makeover-geometry",
449 - "makeover-webview",
450 450 "open",
451 451 "parking_lot",
452 452 "rand 0.10.2",
@@ -3115,6 +3115,23 @@
3115 3115 "toml 1.1.3+spec-1.1.0",
3116 3116 ]
3117 3117
3118 + [[package]]
3119 + name = "makeover"
3120 + version = "2.3.0"
3121 + dependencies = [
3122 + "include_dir",
3123 + "serde",
3124 + "toml 1.1.3+spec-1.1.0",
3125 + ]
3126 +
3127 + [[package]]
3128 + name = "makeover-build"
3129 + version = "0.1.0"
3130 + dependencies = [
3131 + "makeover 2.3.0",
3132 + "makeover-webview",
3133 + ]
3134 +
3118 3135 [[package]]
3119 3136 name = "makeover-geometry"
3120 3137 version = "0.1.0"
@@ -16,9 +16,8 @@
16 16 tauri-build = { version = "2.5.5", features = [] }
17 17 makeover.workspace = true
18 18 makeover-geometry.workspace = true
19 - # Phase A of the description layer: the component stylesheet, emitted at build
20 - # time beside geometry.css. Path dep while unpublished.
21 - makeover-webview = { path = "../../../Libraries/makeover-webview" }
19 + # Materialises themes/ and the phase-A stylesheet. Path dep while unpublished.
20 + makeover-build = { path = "../../../Libraries/makeover-build" }
22 21
23 22 [dependencies]
24 23 bb-interface.workspace = true
@@ -1,31 +1,5 @@
1 1 use std::path::Path;
2 2
3 - /// Write the themes `makeover` ships into `themes/`, where `tauri.conf.json`
4 - /// picks them up as a bundled resource.
5 - ///
6 - /// Tauri's resource globs are read by the Tauri CLI against the crate
7 - /// directory, so they cannot point into a registry checkout or `OUT_DIR`.
8 - /// Materializing the embedded set here keeps `makeover` the single source of
9 - /// truth without vendoring a second copy of the theme files into this repo.
10 - /// The directory is generated, and gitignored.
11 - fn materialize_themes() {
12 - let dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("themes");
13 - std::fs::create_dir_all(&dir).expect("create themes/");
14 -
15 - // Clear stale files first, so a theme removed upstream (or renamed) does
16 - // not linger in the bundle from an earlier build.
17 - for entry in std::fs::read_dir(&dir).expect("read themes/").flatten() {
18 - let path = entry.path();
19 - if path.extension().is_some_and(|e| e == "toml") {
20 - std::fs::remove_file(&path).expect("remove stale theme");
21 - }
22 - }
23 -
24 - for (id, source) in makeover::embedded_themes() {
25 - std::fs::write(dir.join(format!("{id}.toml")), source).expect("write theme");
26 - }
27 - }
28 -
29 3 /// Write the geometry layer `makeover-geometry` defines into
30 4 /// `frontend/css/geometry.css`, which `index.html` links ahead of the
31 5 /// stylesheet.
@@ -69,33 +43,12 @@
69 43 std::fs::write(path, css).expect("write geometry.css");
70 44 }
71 45
72 - /// Write the component layer `makeover-webview` emits into
73 - /// `frontend/css/layout.css`, which `index.html` links after `geometry.css`
74 - /// and before the stylesheet.
75 - ///
76 - /// Third generated file, same shape as the other two: a crate owns the rule,
77 - /// `build.rs` materialises it, this app links it and never edits it.
78 - ///
79 - /// Phase A is the stylesheet only. This app builds its DOM through
80 - /// `createElement` at 175 sites, so adopting generated markup is a migration
81 - /// while adopting a generated stylesheet is a deletion. The `--bevel-*`
82 - /// properties were hand-written in `styles.css` until now, and the crate
83 - /// asserts its emitted text against exactly what this app wrote, so nothing
84 - /// changes on screen.
85 - ///
86 - /// The file is generated, and gitignored.
87 - fn materialize_layout() {
88 - let css = makeover_webview::stylesheet(&makeover_webview::Emit::default());
89 - let path = Path::new(env!("CARGO_MANIFEST_DIR"))
90 - .join("frontend")
91 - .join("css")
92 - .join("layout.css");
93 - std::fs::write(path, css).expect("write layout.css");
94 - }
95 -
96 46 fn main() {
97 - materialize_themes();
47 + // themes/ and frontend/css/layout.css. Both were written out here until
48 + // they had a second identical copy in the other Tauri app; they live in
49 + // makeover-build now. The geometry emitter below stays local, because the
50 + // two apps genuinely disagree about how the touch preset is selected.
51 + makeover_build::tauri_frontend(env!("CARGO_MANIFEST_DIR"), &makeover_build::Emit::default());
98 52 materialize_geometry();
99 - materialize_layout();
100 53 tauri_build::build();
101 54 }