,
pub(crate) props: P,
pub(crate) application_name: Option<&'static str>,
pub(crate) base_path: Option<&'static str>,
pub(crate) head: Option<&'static str>,
+ pub(crate) assets_path: Option<&'static str>,
}
-impl {
+impl {
/// Create a new ServeConfig
pub fn new(app: Component , props: P) -> Self {
Self {
@@ -18,6 +19,7 @@ impl {
application_name: None,
base_path: None,
head: None,
+ assets_path: None,
}
}
@@ -38,4 +40,45 @@ impl {
self.head = Some(head);
self
}
+
+ /// Set the path of the assets folder generated by the Dioxus CLI. (defaults to dist/assets)
+ pub fn assets_path(mut self, assets_path: &'static str) -> Self {
+ self.assets_path = Some(assets_path);
+ self
+ }
+
+ /// Build the ServeConfig
+ pub fn build(self) -> ServeConfig {
+ let base_path = self.base_path.unwrap_or(".");
+ let application_name = self.application_name.unwrap_or("dioxus");
+ ServeConfig {
+ app: self.app,
+ props: self.props,
+ application_name,
+ base_path,
+ head: self.head.map(String::from).unwrap_or(format!(r#" ,
+ pub(crate) props: P,
+ pub(crate) application_name: &'static str,
+ pub(crate) base_path: &'static str,
+ pub(crate) head: String,
+ pub(crate) assets_path: &'static str,
+}
+
+impl {
+ fn from(builder: ServeConfigBuilder ) -> Self {
+ builder.build()
+ }
}