diff --git a/src/assets/index.html b/src/assets/index.html index 7a199d6f3..f57acbd34 100644 --- a/src/assets/index.html +++ b/src/assets/index.html @@ -1,21 +1,22 @@ - - {app_title} - - - - {style_include} - - -
- - {script_include} - - + + {app_title} + + + + {style_include} + + +
+ + + {script_include} + + \ No newline at end of file diff --git a/src/builder.rs b/src/builder.rs index 9d32a4d06..aaaa0278a 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -132,7 +132,7 @@ pub fn build(config: &CrateConfig) -> Result<()> { ); } } - + // this code will copy all public file to the output dir let copy_options = fs_extra::dir::CopyOptions { overwrite: true, @@ -327,6 +327,11 @@ pub fn gen_page(config: &DioxusConfig, serve: bool) -> String { html = html.replace("{app_name}", &config.application.name); + html = match &config.web.app.base_path { + Some(path) => html.replace("{base_path}", path), + None => html.replace("{base_path}", "."), + }; + let title = config .web .app diff --git a/src/config.rs b/src/config.rs index e664edbfc..0cdd0bd8b 100644 --- a/src/config.rs +++ b/src/config.rs @@ -40,11 +40,12 @@ impl Default for DioxusConfig { web: WebConfig { app: WebAppConfing { title: Some("dioxus | ⛺".into()), + base_path: None, }, watcher: WebWatcherConfing { watch_path: Some(vec![PathBuf::from("src")]), reload_html: Some(false), - index_on_404: Some(false), + index_on_404: Some(true), }, resource: WebResourceConfing { dev: WebDevResourceConfing { @@ -79,6 +80,7 @@ pub struct WebConfig { #[derive(Debug, Clone, Serialize, Deserialize)] pub struct WebAppConfing { pub title: Option, + pub base_path: Option, } #[derive(Debug, Clone, Serialize, Deserialize)]