Skip to main content

makeover_webview/
build.rs

1//! Build-script support: the generated files every webview consumer
2//! materialises from its `build.rs`, and the checks that keep its hand-written
3//! frontend agreeing with them.
4//!
5//! Behind the `build` feature. A consumer takes this crate twice: as a
6//! dependency for the markup and as a build-dependency with `features =
7//! ["build"]` for these files. `links` holds both to one version.
8//!
9//! # Density
10//!
11//! [`geometry_css`] keys the touch preset on capability: touch hangs off "not
12//! a fine, hovering pointer" and never off a user-agent string or a
13//! breakpoint. An app with a manual override passes the selector it sets to
14//! `explicit_touch`.
15//!
16//! # Where the files land
17//!
18//! Every emitter writes into the consumer's own crate directory, at the path
19//! it is given. The consumer gitignores every path written here.
20//!
21//! # What is checked rather than written
22//!
23//! [`drift`] holds the checks over the consumer's hand-written stylesheet and
24//! scripts. They assert and panic; none of them rewrites a file.
25
26pub mod drift;
27
28use std::path::Path;
29
30pub use drift::{Allow, Breakpoints, Vocabulary, check_touch_density, check_vocabulary_use};
31
32/// The filenames [`typography_css`]'s `@font-face` rules fetch. A consumer's
33/// build script writes its font files under these names.
34pub use makeover::{WEBFONT_MONO_FILE, WEBFONT_SANS_FILE};
35
36/// Layer 0 of the font model, re-exported for a build script composing an
37/// override.
38pub use makeover::{FontFace, FontOverride, FontSlot, Typography};
39
40/// Write only when the bytes differ, and name `path` with
41/// `rerun-if-changed`. A run that changes nothing moves no mtime.
42fn write_if_changed(path: &Path, contents: &str, what: &str) {
43    // Cargo reruns a build script when a path it named with `rerun-if-changed`
44    // is newer than the script's last output, or has been deleted. Naming the
45    // output is what brings a generated file back after a hand deletion or a
46    // `git clean -X` over a gitignored `themes/`; without it the file stays
47    // gone until an unrelated edit reruns this script. Safe to name because
48    // the write below happens only on a byte difference, so a run with nothing
49    // changed moves no mtime and cannot invalidate itself through this.
50    rerun(path);
51    if std::fs::read_to_string(path).is_ok_and(|existing| existing == contents) {
52        return;
53    }
54    std::fs::write(path, contents).unwrap_or_else(|error| panic!("write {what}: {error}"));
55}
56
57/// Name `path` for cargo to rerun the build script when it changes.
58fn rerun(path: &Path) {
59    println!("cargo::rerun-if-changed={}", path.display());
60}
61
62/// The name of the file [`themes`] writes to record which themes it generated.
63///
64/// Read on the next run to tell a theme this run no longer ships from a
65/// `.toml` the consumer wrote into the same directory, which is left alone.
66/// Not a `.toml`, so it never reads as a theme itself.
67const THEMES_MANIFEST: &str = ".makeover-themes";
68
69/// Write the themes `makeover` ships into `dir`, as `<id>.toml`.
70///
71/// Removes only the `.toml` files a previous run of this function generated
72/// and upstream no longer ships, so a theme removed or renamed upstream does
73/// not linger in the bundle from a previous build. A foreign `.toml` the
74/// consumer placed in the same directory is not recorded and is left alone.
75///
76/// # Panics
77///
78/// If the directory cannot be created, read, or written, or a stale theme
79/// cannot be removed.
80pub fn themes(dir: impl AsRef<Path>) {
81    let dir = dir.as_ref();
82    std::fs::create_dir_all(dir).expect("create themes dir");
83
84    let shipped: std::collections::BTreeSet<String> = makeover::embedded_themes()
85        .map(|(id, _)| id.to_string())
86        .collect();
87
88    // Only what upstream no longer ships, and only what a previous run of this
89    // function wrote: the manifest is the boundary between our generated
90    // output and a consumer's own file. Clearing the directory first and
91    // writing every theme back was the same thing by result and not by mtime:
92    // it left `write_if_changed` nothing to compare against, so every build
93    // rewrote every theme and the script invalidated itself through them.
94    let manifest = dir.join(THEMES_MANIFEST);
95    if let Ok(previous) = std::fs::read_to_string(&manifest) {
96        for stem in previous.lines().filter(|line| !line.is_empty()) {
97            // Already gone is the state this sweep is after.
98            if !shipped.contains(stem)
99                && let Err(e) = std::fs::remove_file(dir.join(format!("{stem}.toml")))
100                && e.kind() != std::io::ErrorKind::NotFound
101            {
102                panic!("remove stale theme {stem}: {e}");
103            }
104        }
105    }
106
107    for (id, source) in makeover::embedded_themes() {
108        write_if_changed(&dir.join(format!("{id}.toml")), source, "theme");
109    }
110
111    // Written last, so it names only what this run actually produced. The
112    // `write_if_changed` keeps it as stable as the themes it lists, which is
113    // the same idempotency the theme files themselves get.
114    let body = shipped.iter().cloned().collect::<Vec<_>>().join("\n");
115    write_if_changed(&manifest, &body, "themes manifest");
116}
117
118/// Write `makeover-webview`'s component stylesheet, [`crate::stylesheet`]
119/// for `opts`, to `path`.
120///
121/// # Panics
122///
123/// If the file cannot be written.
124pub fn layout_css(path: impl AsRef<Path>, opts: &crate::Emit) {
125    write_if_changed(path.as_ref(), &crate::stylesheet(opts), "layout css");
126}
127
128/// Write `makeover-geometry`'s spacing layer, with its canonical density
129/// selection, to `path`.
130///
131/// The policy is `makeover-geometry`'s: touch hangs off the negation of a
132/// fine, hovering pointer, and `explicit_touch` names a selector an app sets
133/// when the user has chosen. See [`makeover_geometry::density_css`]. This adds
134/// the generated-file banner and the write.
135///
136/// The file is, in order: [`makeover_geometry::density_css`],
137/// [`makeover_geometry::size_class_css`], which tightens the two shells on a
138/// compact window whichever density selected them, and
139/// [`makeover_geometry::compactness_css`], unlayered, so its row-packing
140/// override beats the `--row-block` default the density block wrote.
141///
142/// # Panics
143///
144/// If the file cannot be written.
145pub fn geometry_css(path: impl AsRef<Path>, explicit_touch: Option<&str>) {
146    let mut css = String::from(
147        "/* Generated by makeover-webview from makeover-geometry. Do not edit.\n   \
148         Spacing is named by relationship, not by size. Touch density is a\n   \
149         capability question: a narrow desktop window still has a pointer, a\n   \
150         full-width tablet still has a finger. Window width is the separate\n   \
151         question below it: on a compact window the two shells tighten. */\n",
152    );
153    css.push_str(&makeover_geometry::density_css(explicit_touch));
154    css.push('\n');
155    css.push_str(&makeover_geometry::size_class_css());
156    css.push('\n');
157    css.push_str(&makeover_geometry::compactness_css());
158    write_if_changed(path.as_ref(), &css, "geometry css");
159}
160
161/// Write `makeover-timing`'s time axis, and the motion-off block that rides
162/// with it, to `path`.
163///
164/// The file declares `--timing-*`, `--motion-*` and `--cadence-*`. This adds
165/// the banner and the write; `makeover_timing::timing_css` is the whole file
166/// and wraps itself in [`makeover_geometry::CSS_LAYER`].
167///
168/// # The `prefers-reduced-motion` block
169///
170/// `makeover_timing::timing_css` emits the `:root` values and then a media
171/// block zeroing every motion and cadence (`--motion-fade`, `--motion-quick`,
172/// `--cadence-activity`). Both land here, in that order.
173///
174/// # Panics
175///
176/// If the file cannot be written.
177pub fn timing_css(path: impl AsRef<Path>) {
178    let mut css = String::from(
179        "/* Generated by makeover-webview from makeover-timing. Do not edit.\n   \
180         A duration is named by what it is waiting for; the number follows.\n   \
181         Three axes: how long a state lasts, how long a change takes, and how\n   \
182         often a repeating mark repeats. The reduced-motion block below zeroes\n   \
183         the last two and leaves the waits alone. A reader asking for less\n   \
184         motion has not asked for a notice to leave early. */\n",
185    );
186    css.push_str(&makeover_timing::timing_css());
187    write_if_changed(path.as_ref(), &css, "timing css");
188}
189
190/// Write the house typography layer to `path`: the two `@font-face` rules and
191/// the two tokens they back.
192///
193/// `font_url` is the directory the fonts are fetched from, without a trailing
194/// slash, as a `url()` resolves it: against the generated stylesheet, not the
195/// page. `/static/fonts` on the MNW server; `../fonts` for a Tauri frontend
196/// writing this file to `frontend/css/typography.css` with its fonts in
197/// `frontend/fonts`, which is what [`tauri_frontend`] passes.
198///
199/// The file declares no `@layer`.
200///
201/// # The consumer still has to put the faces there
202///
203/// This writes the CSS that fetches `QuasiMono.woff2` and `QuasiBody.woff2`;
204/// it does not write the fonts. A consumer cuts them with `quasi-type` (a git
205/// dependency, `quasi_type::cut`) in its own `build.rs`, writing each slot's
206/// woff2 under [`makeover::WEBFONT_MONO_FILE`] and
207/// [`makeover::WEBFONT_SANS_FILE`].
208///
209/// # Panics
210///
211/// If the file cannot be written.
212pub fn typography_css(path: impl AsRef<Path>, font_url: &str) {
213    typography_css_from(path, &makeover::Typography::house(font_url));
214}
215
216/// [`typography_css`], for a product that overrides a slot.
217///
218/// Layer 0 of the font model. A product with a brand face declares it here,
219/// and the generated sheet carries both the `@font-face` and the token:
220///
221/// ```no_run
222/// use makeover_webview::build::{FontFace, FontOverride, FontSlot, Typography};
223///
224/// makeover_webview::build::typography_css_from(
225///     "static/typography.css",
226///     &Typography::house("/static/fonts").with_override(
227///         FontOverride::new(FontSlot::Display, "\"Young Serif\", serif")
228///             .with_face(FontFace::new("Young Serif", ["ysrf.woff2", "ysrf.ttf"])),
229///     ),
230/// );
231/// ```
232///
233/// The product still ships the face file itself; this writes the CSS that
234/// fetches it.
235///
236/// # Panics
237///
238/// If the file cannot be written.
239pub fn typography_css_from(path: impl AsRef<Path>, typography: &makeover::Typography) {
240    let mut css = String::from(
241        "/* Generated by makeover-webview from makeover. Do not edit.\n   \
242         Two needs, two names, then a system generic. The faces are cut by\n   \
243         quasi-type from Atkinson Hyperlegible plus the house glyph set, and\n   \
244         both are variable over wght 200-800 in one file, which is why the\n   \
245         @font-face rules name the range. The mono face opens at ExtraLight.\n   \
246         A third token here is this product's own brand face, declared as an\n   \
247         override in its build script. */\n\n",
248    );
249    css.push_str(&typography.css());
250    write_if_changed(path.as_ref(), &css, "typography css");
251}
252
253/// All the generated files at the Tauri layout: `themes/` beside the
254/// manifest, and `frontend/css/{geometry,timing,layout,typography}.css` under
255/// it.
256///
257/// Pass `env!("CARGO_MANIFEST_DIR")`. A consumer that wants different paths
258/// calls [`themes`], [`geometry_css`], [`timing_css`], [`layout_css`] and
259/// [`typography_css`] directly.
260///
261/// The font URL is `../fonts`: a `url()` resolves against the stylesheet, so
262/// from `frontend/css/typography.css` that is `frontend/fonts`.
263///
264/// # Panics
265///
266/// If any file cannot be written.
267pub fn tauri_frontend(
268    manifest_dir: impl AsRef<Path>,
269    opts: &crate::Emit,
270    explicit_touch: Option<&str>,
271) {
272    tauri_frontend_with(
273        manifest_dir,
274        opts,
275        explicit_touch,
276        &makeover::Typography::house("../fonts"),
277    );
278}
279
280/// [`tauri_frontend`], for a product that overrides a font slot.
281///
282/// The base URL is the caller's: `Typography::house("../fonts")` is what
283/// [`tauri_frontend`] passes.
284///
285/// # Panics
286///
287/// If any file cannot be written.
288pub fn tauri_frontend_with(
289    manifest_dir: impl AsRef<Path>,
290    opts: &crate::Emit,
291    explicit_touch: Option<&str>,
292    typography: &makeover::Typography,
293) {
294    let root = manifest_dir.as_ref();
295    let css = root.join("frontend").join("css");
296    themes(root.join("themes"));
297    geometry_css(css.join("geometry.css"), explicit_touch);
298    // Beside geometry rather than after layout: both are value files the
299    // component sheet reads, and a consumer's `<link>` order follows this one.
300    timing_css(css.join("timing.css"));
301    layout_css(css.join("layout.css"), opts);
302    typography_css_from(css.join("typography.css"), typography);
303}
304
305#[cfg(test)]
306mod tests {
307    use super::*;
308    use crate::test_support::scratch;
309
310    #[test]
311    fn themes_are_written_one_file_per_id() {
312        let dir = scratch("themes");
313        themes(&dir);
314        // `.toml` only: the run also writes the manifest, which is not a theme.
315        let count = std::fs::read_dir(&dir)
316            .unwrap()
317            .flatten()
318            .filter(|entry| entry.path().extension().is_some_and(|ext| ext == "toml"))
319            .count();
320        assert_eq!(count, makeover::embedded_themes().count());
321        assert!(count > 0, "makeover ships no themes?");
322    }
323
324    #[test]
325    fn a_theme_removed_upstream_does_not_linger() {
326        // The detail that makes this worth sharing rather than retyping. A
327        // previous run generated `gone-upstream.toml` and recorded it in the
328        // manifest; this run no longer ships it, so the recorded entry is what
329        // marks the file stale.
330        let dir = scratch("stale");
331        std::fs::write(dir.join("gone-upstream.toml"), "# stale").unwrap();
332        std::fs::write(dir.join(THEMES_MANIFEST), "gone-upstream\n").unwrap();
333        themes(&dir);
334        assert!(!dir.join("gone-upstream.toml").exists());
335    }
336
337    #[test]
338    fn repro_themes_stale_removal_panics_on_missing_file() {
339        // The manifest names a theme upstream dropped whose file is already
340        // gone: the file being absent is the end state the sweep wants.
341        let dir = scratch("stale-gone");
342        std::fs::write(dir.join(THEMES_MANIFEST), "gone-upstream\n").unwrap();
343        themes(&dir);
344        let manifest = std::fs::read_to_string(dir.join(THEMES_MANIFEST)).unwrap();
345        assert!(!manifest.lines().any(|line| line == "gone-upstream"));
346    }
347
348    #[test]
349    fn a_foreign_toml_that_was_not_generated_survives() {
350        // The manifest is the boundary: a `.toml` the consumer placed here was
351        // never generated by `themes`, so a rebuild must not clear it the way
352        // the old by-stem sweep did.
353        let dir = scratch("foreign");
354        std::fs::write(dir.join("user-custom.toml"), "# mine").unwrap();
355        themes(&dir);
356        assert!(dir.join("user-custom.toml").exists());
357    }
358
359    #[test]
360    fn a_second_run_touches_nothing() {
361        // The property the whole write-if-changed pass exists for: a build
362        // script that rewrites its own outputs invalidates itself, and cargo
363        // then reruns it on every build whatever changed. Asserted on mtime
364        // rather than on content, because content was always correct; it was
365        // the mtime that was the bug.
366        let dir = scratch("idempotent");
367        themes(&dir);
368        let before: Vec<_> = std::fs::read_dir(&dir)
369            .unwrap()
370            .flatten()
371            .map(|e| (e.path(), e.metadata().unwrap().modified().unwrap()))
372            .collect();
373        assert!(!before.is_empty(), "themes() wrote nothing to compare");
374
375        themes(&dir);
376        for (path, was) in before {
377            let now = std::fs::metadata(&path).unwrap().modified().unwrap();
378            assert_eq!(
379                was,
380                now,
381                "{} was rewritten by a second run with nothing changed",
382                path.display()
383            );
384        }
385    }
386
387    #[test]
388    fn a_generated_output_is_named_with_rerun_if_changed() {
389        // A deleted output, or a gitignored `themes/` emptied by `git clean
390        // -X`, has to be regenerated on the next build. That only happens if
391        // every write names its path with `rerun-if-changed`, which cargo
392        // treats as an input: a path newer than the script's last output, or
393        // gone, reruns it. Observed through a child process because the test
394        // harness owns this process's stdout and swallows a `println!`.
395        let exe = std::env::current_exe().expect("test binary path");
396        let child = std::process::Command::new(exe)
397            .args(["--nocapture", "emit_rerun_directive_child"])
398            .env("MAKEOVER_EMIT_RERUN", "1")
399            .output()
400            .expect("spawn child");
401        assert!(child.status.success(), "child failed: {child:?}");
402        let stdout = String::from_utf8_lossy(&child.stdout);
403        assert!(
404            stdout.contains("cargo::rerun-if-changed="),
405            "write_if_changed named no output with rerun-if-changed:\n{stdout}"
406        );
407    }
408
409    /// The child for [`a_generated_output_is_named_with_rerun_if_changed`]:
410    /// a silent no-op unless the parent set the trigger, so the ordinary suite
411    /// run does not write files or print directives.
412    #[test]
413    fn emit_rerun_directive_child() {
414        if std::env::var_os("MAKEOVER_EMIT_RERUN").is_none() {
415            return;
416        }
417        layout_css(
418            scratch("rerun-directive").join("layout.css"),
419            &crate::Emit::default(),
420        );
421    }
422
423    #[test]
424    fn a_non_theme_file_is_left_alone() {
425        // Only .toml is cleared, so a README or a .gitignore in the bundle
426        // directory survives a rebuild.
427        let dir = scratch("keep");
428        std::fs::write(dir.join("README.md"), "not a theme").unwrap();
429        themes(&dir);
430        assert!(dir.join("README.md").exists());
431    }
432
433    #[test]
434    fn the_stylesheet_lands_and_names_no_colour() {
435        let dir = scratch("css");
436        let path = dir.join("layout.css");
437        layout_css(&path, &crate::Emit::default());
438        let css = std::fs::read_to_string(&path).unwrap();
439        assert!(css.contains("--bevel-raised"));
440        assert!(
441            !css.contains('#'),
442            "a colour literal reached a build output"
443        );
444    }
445
446    #[test]
447    fn the_typography_file_declares_the_faces_before_the_tokens_that_name_them() {
448        // The vocabulary itself is tested in makeover. What is this crate's
449        // job is that both halves reach one file, in an order that works: a
450        // `@font-face` may follow its use in the cascade, but reading the file
451        // is how anyone finds out a face is fetched at all.
452        let dir = scratch("typography");
453        let path = dir.join("typography.css");
454        typography_css(&path, "/static/fonts");
455        let css = std::fs::read_to_string(&path).unwrap();
456
457        assert!(css.starts_with("/* Generated by makeover-webview"));
458        assert!(
459            css.find("@font-face").unwrap() < css.find(":root").unwrap(),
460            "the tokens come first, so the file reads as a stack with no ground"
461        );
462        assert!(css.contains("url(\"/static/fonts/QuasiMono.woff2\")"));
463        assert!(css.contains("--font-sans: \"Quasi Body\", sans-serif;"));
464
465        // Not a cascade layer. `@font-face` takes no part in the cascade and a
466        // consumer may need these rules ahead of a layer order it declares
467        // elsewhere, so wrapping this file in one would be a silent trap.
468        assert!(!css.contains("@layer"));
469    }
470
471    #[test]
472    fn an_overridden_slot_reaches_the_same_file_as_the_house_two() {
473        // Layer 0's whole point: the brand face stops being a hand-maintained
474        // `@font-face` in the app's own stylesheet and becomes a line in the
475        // generated one, beside the slots it sits next to.
476        let dir = scratch("typography-override");
477        let path = dir.join("typography.css");
478        typography_css_from(
479            &path,
480            &Typography::house("/static/fonts").with_override(
481                FontOverride::new(FontSlot::Display, "\"Young Serif\", serif")
482                    .with_face(FontFace::new("Young Serif", ["ysrf.woff2", "ysrf.ttf"])),
483            ),
484        );
485        let css = std::fs::read_to_string(&path).unwrap();
486
487        // `@font-face {`, not `@font-face`: the header comment names the
488        // at-rule too, and counting that would make this pass for the wrong
489        // reason the day the comment is reworded.
490        assert_eq!(css.matches("@font-face {").count(), 3);
491        assert!(css.contains("--font-display: \"Young Serif\", serif;"));
492        assert!(css.contains("--font-mono: \"Quasi Mono\", monospace;"));
493        assert!(css.contains("url(\"/static/fonts/ysrf.ttf\") format(\"truetype\")"));
494        assert!(!css.contains("@layer"));
495    }
496
497    #[test]
498    fn the_default_tauri_layout_is_the_house_layer_and_nothing_else() {
499        // `tauri_frontend` delegating through `tauri_frontend_with` must not
500        // change a byte for the three consumers already calling it.
501        let dir = scratch("tauri-default");
502        let plain = dir.join("plain.css");
503        let house = dir.join("house.css");
504        typography_css(&plain, "../fonts");
505        typography_css_from(&house, &Typography::house("../fonts"));
506        assert_eq!(
507            std::fs::read_to_string(&plain).unwrap(),
508            std::fs::read_to_string(&house).unwrap()
509        );
510    }
511
512    #[test]
513    fn the_geometry_file_carries_the_crates_policy_and_a_banner() {
514        // The policy itself is tested in makeover-geometry. What is this
515        // crate's job is that the banner is there and the policy reached the
516        // file at all.
517        let dir = scratch("geometry");
518        let path = dir.join("geometry.css");
519        geometry_css(&path, Some(".ui-mode-mobile"));
520        let css = std::fs::read_to_string(&path).unwrap();
521        assert!(css.starts_with("/* Generated by makeover-webview"));
522        assert!(css.contains(&format!(
523            "@media {}",
524            makeover_geometry::Density::Touch.media_condition()
525        )));
526        assert!(css.contains(".ui-mode-mobile"));
527        // The width axis rides along, and only the shells are in it: a gap
528        // between two controls in a width query is the bug size_class_css
529        // exists to keep out.
530        assert!(css.contains("--gap-pane"), "no compact shell override");
531        let compact = css
532            .split(&format!(
533                "@media {}",
534                makeover_geometry::SizeClass::Compact.media_condition()
535            ))
536            .nth(1)
537            .expect("compact block");
538        assert!(
539            !compact.contains("--gap-peer"),
540            "a control gap crept into a width query"
541        );
542        // Row packing rides along, unlayered: the reader's compact override
543        // must beat the `--row-block` default the density block wrote.
544        assert!(
545            css.contains(&format!(
546                ":root[{}=\"{}\"]",
547                makeover_geometry::COMPACTNESS_ATTRIBUTE,
548                makeover_geometry::Compactness::Compact.attribute_value()
549            )),
550            "no compact row-packing override"
551        );
552    }
553
554    #[test]
555    fn the_timing_file_carries_the_values_and_the_block_that_overrides_them() {
556        // The rungs themselves are tested in makeover-timing. What is this
557        // crate's to get wrong is dropping half the file: the values are
558        // useless noise without the media block, and the media block on its
559        // own overrides nothing.
560        let dir = scratch("timing");
561        let path = dir.join("timing.css");
562        timing_css(&path);
563        let css = std::fs::read_to_string(&path).unwrap();
564        assert!(css.starts_with("/* Generated by makeover-webview"));
565        // One token per axis, so a crate that grows a fourth axis and is not
566        // emitted here fails somewhere other than on screen.
567        assert!(css.contains("--timing-dismiss"), "no intent tokens");
568        assert!(css.contains("--motion-fade"), "no motion token");
569        assert!(css.contains("--cadence-activity"), "no cadence token");
570        assert!(
571            css.contains("@media (prefers-reduced-motion: reduce)"),
572            "the values shipped without the block that turns them off"
573        );
574        // The block comes after the values it overrides. Same specificity,
575        // so the order is the whole of the win.
576        assert!(
577            css.find(":root").unwrap() < css.find("prefers-reduced-motion").unwrap(),
578            "the motion-off block cannot override values declared after it"
579        );
580        // Inside the family's layer, like every other generated sheet:
581        // unlayered declarations outrank every named layer, so a generated
582        // file outside it beats the app's own overrides.
583        assert!(css.contains(makeover_geometry::CSS_LAYER));
584    }
585
586    #[test]
587    fn the_tauri_layout_puts_all_four_where_the_apps_look() {
588        let root = scratch("tauri");
589        std::fs::create_dir_all(root.join("frontend").join("css")).unwrap();
590        tauri_frontend(&root, &crate::Emit::default(), None);
591        let css = root.join("frontend").join("css");
592        for file in ["geometry.css", "timing.css", "layout.css", "typography.css"] {
593            assert!(css.join(file).exists(), "{file} was not written");
594        }
595        assert!(root.join("themes").is_dir());
596    }
597}