Skip to content

Commit b3a990b

Browse files
authored
fix(dioxus): fix template-dioxus loading assets error (#909)
* fix: template-dioxus loading assets error * Update .changes/change.md
1 parent 789113d commit b3a990b

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.changes/change.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"create-tauri-app": patch
3+
"create-tauri-app-js": patch
4+
---
5+
6+
fix template-dioxus loading assets error

templates/template-dioxus/src/app.rs.lte

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ use dioxus::prelude::*;
44
use serde::{Deserialize, Serialize};
55
use wasm_bindgen::prelude::*;
66

7+
static CSS: Asset = asset!("/assets/styles.css");
8+
static TAURI_ICON: Asset = asset!("/assets/tauri.svg");
9+
static DIOXUS_ICON: Asset = asset!("/assets/dioxus.png");
10+
711
#[wasm_bindgen]
812
extern "C" {
913
#[wasm_bindgen(js_namespace = ["window", "__TAURI__", "{% if v2 %}core{% else %}tauri{% endif %}"])]
@@ -32,7 +36,7 @@ pub fn App() -> Element {
3236
};
3337

3438
rsx! {
35-
link { rel: "stylesheet", href: "styles.css" }
39+
link { rel: "stylesheet", href: CSS }
3640
main {
3741
class: "container",
3842
h1 { "Welcome to Tauri + Dioxus" }
@@ -43,7 +47,7 @@ pub fn App() -> Element {
4347
href: "https://tauri.app",
4448
target: "_blank",
4549
img {
46-
src: "/tauri.svg",
50+
src: TAURI_ICON,
4751
class: "logo tauri",
4852
alt: "Tauri logo"
4953
}
@@ -52,7 +56,7 @@ pub fn App() -> Element {
5256
href: "https://dioxuslabs.com/",
5357
target: "_blank",
5458
img {
55-
src: "/dioxus.png",
59+
src: DIOXUS_ICON,
5660
class: "logo dioxus",
5761
alt: "Dioxus logo"
5862
}

0 commit comments

Comments
 (0)