Adds a minimal SSR-only Leptos dashboard to the operator, gated by a new `web-frontend` cargo feature. The whole frontend (HTML + Tailwind CSS) is bundled into the binary via `include_str!`, no cargo-leptos / WASM / hydration involved — air-gap clean, single container. build.rs invokes the standalone tailwindcss v4 CLI when the feature is on. Default builds are untouched. Static skeleton only — no interactivity yet. Kept as a comparison baseline for the Maud + HTMX variant on the next branch.
39 lines
1.2 KiB
Rust
39 lines
1.2 KiB
Rust
use std::path::PathBuf;
|
|
use std::process::Command;
|
|
|
|
fn main() {
|
|
if std::env::var_os("CARGO_FEATURE_WEB_FRONTEND").is_none() {
|
|
return;
|
|
}
|
|
|
|
let manifest_dir = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
|
|
let input = manifest_dir.join("style/input.css");
|
|
let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap());
|
|
let output = out_dir.join("tailwind.css");
|
|
|
|
println!("cargo:rerun-if-changed=style/input.css");
|
|
println!("cargo:rerun-if-changed=src/frontend");
|
|
|
|
let result = Command::new("tailwindcss")
|
|
.arg("--input")
|
|
.arg(&input)
|
|
.arg("--output")
|
|
.arg(&output)
|
|
.arg("--minify")
|
|
.status();
|
|
|
|
match result {
|
|
Ok(s) if s.success() => {}
|
|
Ok(s) => panic!(
|
|
"tailwindcss exited with status {s}. The `web-frontend` feature requires \
|
|
the standalone Tailwind CSS v4 CLI on PATH \
|
|
(https://github.com/tailwindlabs/tailwindcss/releases)."
|
|
),
|
|
Err(e) => panic!(
|
|
"failed to invoke `tailwindcss`: {e}. The `web-frontend` feature requires \
|
|
the standalone Tailwind CSS v4 CLI on PATH \
|
|
(https://github.com/tailwindlabs/tailwindcss/releases)."
|
|
),
|
|
}
|
|
}
|