crates/gunnar-ui-web/src/main.rs
//! Mount point for the console.
//!
//! Every module that touches the DOM is gated on `wasm32` so the crate still
//! compiles for the host target — `cargo build --workspace` and `cargo test`
//! run on the host, and a workspace member that only builds for wasm would
//! break both.
#[cfg(target_arch = "wasm32")]
fn main() {
console_error_panic_hook::set_once();
// ★ GUN-GUEST: the server's shell carries the page's content as plain HTML in
// `<main id="prerender">` (what a crawler reads). The live console takes its
// place: it is removed as the console mounts, so both are never on screen.
if let Some(prerender) = web_sys::window().and_then(|w| w.document()).and_then(|d| d.get_element_by_id("prerender")) {
prerender.remove();
}
leptos::mount::mount_to_body(gunnar_ui_web::App);
}
/// Placeholder so the workspace builds on the host target.
#[cfg(not(target_arch = "wasm32"))]
fn main() {
eprintln!("gunnar-ui-web is a WebAssembly binary; build it with `trunk build`");
}