DioxusLabs / dioxus

Fullstack GUI library for web, desktop, mobile, and more.
https://dioxuslabs.com
Apache License 2.0
18.5k stars 704 forks source link

[Desktop] Asset inclusion not working #2345

Open Anonyfox opened 2 weeks ago

Anonyfox commented 2 weeks ago

Problem

Steps To Reproduce

Steps to reproduce the behavior:

... the CSS from main.css is not loaded at all.

...
# include `assets` in web platform
[web.resource]

# CSS style file

style = ["assets/main.css"]

# Javascript code file
script = []
...

no difference.

[ERROR] dioxus_desktop::protocol - Failed to read "/path/to/my/crate/dist/dist/__assets_head.html": No such file or directory (os error 2)

where it clearly adds the /dist part twice. the file does exist in the dist folder at the correct location on my disk, no idea whats wrong here. no idea whats wrong. No success with removing that error so far.

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

Bildschirmfoto 2024-04-19 um 20 33 53

Environment:

Questionnaire

terhechte commented 5 days ago

I have the same issue when using it for a web project. I did find a workout, but its more of a hack tbh.: Install Manganis so that it can embed the css for you. This, however, will not work yet. Changing the css will not force a recompile that incorporates the css. So I added an unnamed number variable below. Increasing the number will force a recompile and any changes you made to your css will be picked up.

const _: &str = manganis::mg!(file("./assets/main.css"));
const _: &str = "2";

Note that I get a rust-analyser error for the first line (file not found) but it compiles just fine with dx...

thurn commented 18 hours ago

Also seeing this. The tailwind example doesn't work at all on desktop on the current version (0.5.1) but it does work on master when using

dioxus = { version = "0.5.2", features = ["desktop"], git = "https://github.com/DioxusLabs/dioxus.git" }

So possibly this issue has recently been fixed and we're just waiting for a release?

mrguiman commented 13 hours ago

Same problem here when serving on macOS. This looks like a macOS specific issue, as our project still works fine when building on linux