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