| 1 |
|
- |
use std::path::Path;
|
| 2 |
|
- |
|
| 3 |
|
- |
/// Write the geometry layer `makeover-geometry` defines into
|
| 4 |
|
- |
/// `frontend/css/geometry.css`, which `index.html` links ahead of the
|
| 5 |
|
- |
/// stylesheet.
|
| 6 |
|
- |
///
|
| 7 |
|
- |
/// Baked at build time rather than applied from JS the way themes are, because
|
| 8 |
|
- |
/// geometry never changes at runtime: there is no geometry picker, so nothing
|
| 9 |
|
- |
/// to re-apply and no reason to pay for a second pass over `:root` on load.
|
| 10 |
|
- |
///
|
| 11 |
|
- |
/// The desktop preset goes in `:root`; the touch preset overrides only the
|
| 12 |
|
- |
/// relational layer, scoped to the `ui-mode-mobile` class `bootstrap-uimode.js`
|
| 13 |
|
- |
/// puts on `<html>` before the stylesheet evaluates. Both selectors match the
|
| 14 |
|
- |
/// root element with the same specificity, so the override has to come second,
|
| 15 |
|
- |
/// which is the order these are written in.
|
| 16 |
|
- |
///
|
| 17 |
|
- |
/// The file is generated, and gitignored.
|
| 18 |
|
- |
fn materialize_geometry() {
|
| 19 |
|
- |
use makeover_geometry::{Density, gap_css_overrides, geometry_css_vars};
|
| 20 |
|
- |
|
| 21 |
|
- |
let mut css = String::from(
|
| 22 |
|
- |
"/* Generated by build.rs from makeover-geometry. Do not edit.\n \
|
| 23 |
|
- |
Spacing is named by relationship, not by size: see the crate's README\n \
|
| 24 |
|
- |
and wiki note makeover-geometry. */\n",
|
| 25 |
|
- |
);
|
| 26 |
|
- |
css.push_str(&geometry_css_vars(Density::Pointer));
|
| 27 |
|
- |
css.push('\n');
|
| 28 |
|
- |
css.push_str(&gap_css_overrides(".ui-mode-mobile", Density::Touch));
|
| 29 |
|
- |
|
| 30 |
|
- |
let path = Path::new(env!("CARGO_MANIFEST_DIR"))
|
| 31 |
|
- |
.join("frontend")
|
| 32 |
|
- |
.join("css")
|
| 33 |
|
- |
.join("geometry.css");
|
| 34 |
|
- |
std::fs::write(path, css).expect("write geometry.css");
|
| 35 |
|
- |
}
|
| 36 |
|
- |
|
| 37 |
1 |
|
fn main() {
|
| 38 |
|
- |
// themes/ and frontend/css/layout.css. Both were written out here until
|
| 39 |
|
- |
// they had a second identical copy in the other Tauri app; they live in
|
| 40 |
|
- |
// makeover-build now. The geometry emitter below stays local, because the
|
| 41 |
|
- |
// two apps genuinely disagree about how the touch preset is selected.
|
| 42 |
|
- |
makeover_build::tauri_frontend(env!("CARGO_MANIFEST_DIR"), &makeover_build::Emit::default());
|
| 43 |
|
- |
materialize_geometry();
|
|
2 |
+ |
// All three generated files: themes/, geometry.css, layout.css. The
|
|
3 |
+ |
// geometry emitter moved out too once density selection was settled:
|
|
4 |
+ |
// touch is a capability, so it hangs off (hover: none), (pointer: coarse)
|
|
5 |
+ |
// rather than a user-agent string or a breakpoint.
|
|
6 |
+ |
makeover_build::tauri_frontend(
|
|
7 |
+ |
env!("CARGO_MANIFEST_DIR"),
|
|
8 |
+ |
&makeover_build::Emit::default(),
|
|
9 |
+ |
Some(".ui-mode-mobile"),
|
|
10 |
+ |
);
|
| 44 |
11 |
|
tauri_build::build();
|
| 45 |
12 |
|
}
|