From 742721bfded2f6d0ea8e2d752be02dbc4b0e18a8 Mon Sep 17 00:00:00 2001 From: Evan Almloff Date: Wed, 10 Jul 2024 16:59:08 -0700 Subject: [PATCH] expose static site generation in the launch builder and prelude --- packages/dioxus/src/launch.rs | 14 ++++++++++++++ packages/dioxus/src/lib.rs | 7 +++++++ packages/static-generation/src/lib.rs | 5 +++++ 3 files changed, 26 insertions(+) diff --git a/packages/dioxus/src/launch.rs b/packages/dioxus/src/launch.rs index e8913fc2f..ace77a653 100644 --- a/packages/dioxus/src/launch.rs +++ b/packages/dioxus/src/launch.rs @@ -94,6 +94,20 @@ impl LaunchBuilder { } } + /// Launch your static site generation application. + #[cfg(feature = "static-generation")] + #[cfg_attr(docsrs, doc(cfg(feature = "static-generation")))] + pub fn static_generation() -> LaunchBuilder + { + LaunchBuilder { + launch_fn: |root, contexts, cfg| { + dioxus_static_site_generation::launch::launch(root, contexts, cfg) + }, + contexts: Vec::new(), + platform_config: None, + } + } + /// Launch your fullstack application. #[cfg(feature = "mobile")] #[cfg_attr(docsrs, doc(cfg(feature = "mobile")))] diff --git a/packages/dioxus/src/lib.rs b/packages/dioxus/src/lib.rs index f9dd85c46..af2f57fbc 100644 --- a/packages/dioxus/src/lib.rs +++ b/packages/dioxus/src/lib.rs @@ -104,6 +104,13 @@ pub mod prelude { #[cfg_attr(docsrs, doc(cfg(feature = "fullstack")))] pub use dioxus_fullstack::prelude::*; + #[cfg(all(feature = "static-generation", not(feature = "fullstack")))] + #[cfg_attr( + docsrs, + doc(cfg(all(feature = "static-generation", not(feature = "fullstack")))) + )] + pub use dioxus_static_site_generation::prelude::*; + #[cfg(feature = "router")] #[cfg_attr(docsrs, doc(cfg(feature = "router")))] pub use dioxus_router; diff --git a/packages/static-generation/src/lib.rs b/packages/static-generation/src/lib.rs index 2fc0e81a2..2b5afef8a 100644 --- a/packages/static-generation/src/lib.rs +++ b/packages/static-generation/src/lib.rs @@ -6,3 +6,8 @@ pub mod launch; #[cfg(feature = "server")] pub(crate) mod ssg; + +/// A prelude of commonly used items in static generation apps. +pub mod prelude { + pub use dioxus_fullstack::prelude::*; +}