Merge branch 'master' into master
This commit is contained in:
3 files changed
+28
-20
No files matched your search
+20
-19
@@ -1,21 +1,22 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>{app_title}</title>
|
<title>{app_title}</title>
|
||||||
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
|
<meta content="text/html;charset=utf-8" http-equiv="Content-Type" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
{style_include}
|
{style_include}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="main"></div>
|
<div id="main"></div>
|
||||||
<script type="module">
|
<!-- Note the usage of `type=module` here as this is an ES6 module -->
|
||||||
import init from "./assets/dioxus/{app_name}.js";
|
<script type="module">
|
||||||
init("./assets/dioxus/{app_name}_bg.wasm").then(wasm => {
|
import init from "{base_path}/assets/dioxus/{app_name}.js";
|
||||||
if (wasm.__wbindgen_start == undefined) {
|
init("{base_path}/assets/dioxus/{app_name}_bg.wasm").then(wasm => {
|
||||||
wasm.main();
|
if (wasm.__wbindgen_start == undefined) {
|
||||||
}
|
wasm.main();
|
||||||
});
|
}
|
||||||
</script>
|
});
|
||||||
{script_include}
|
</script>
|
||||||
</body>
|
{script_include}
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -327,6 +327,11 @@ pub fn gen_page(config: &DioxusConfig, serve: bool) -> String {
|
|||||||
|
|
||||||
html = html.replace("{app_name}", &config.application.name);
|
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
|
let title = config
|
||||||
.web
|
.web
|
||||||
.app
|
.app
|
||||||
|
|||||||
+3
-1
@@ -40,11 +40,12 @@ impl Default for DioxusConfig {
|
|||||||
web: WebConfig {
|
web: WebConfig {
|
||||||
app: WebAppConfing {
|
app: WebAppConfing {
|
||||||
title: Some("dioxus | ⛺".into()),
|
title: Some("dioxus | ⛺".into()),
|
||||||
|
base_path: None,
|
||||||
},
|
},
|
||||||
watcher: WebWatcherConfing {
|
watcher: WebWatcherConfing {
|
||||||
watch_path: Some(vec![PathBuf::from("src")]),
|
watch_path: Some(vec![PathBuf::from("src")]),
|
||||||
reload_html: Some(false),
|
reload_html: Some(false),
|
||||||
index_on_404: Some(false),
|
index_on_404: Some(true),
|
||||||
},
|
},
|
||||||
resource: WebResourceConfing {
|
resource: WebResourceConfing {
|
||||||
dev: WebDevResourceConfing {
|
dev: WebDevResourceConfing {
|
||||||
@@ -79,6 +80,7 @@ pub struct WebConfig {
|
|||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct WebAppConfing {
|
pub struct WebAppConfing {
|
||||||
pub title: Option<String>,
|
pub title: Option<String>,
|
||||||
|
pub base_path: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
|||||||
Reference in new issue
Block a user