serving .css via asset! macro doesn't work on native
- Dominant language
- Rust
- Stars
- 4.1k
- Forks
- 203
- Avg merge
- 8h 58m
- Merged PRs (30d)
- 112
Description
When testing on the different dioxus demos and the `native-headless-in-bevy` demo, blitz is unable to use the `asset!` macro with .css. This is not an issue dx serving via --desktop.
the difference, on my machine, between `asset!` and `include_str!` when working on .css files is around sub-1 second re-load vs 10+ seconds while requiring recompiling and relaunching the entire app.
loading .css in the `wgpu_texture` demo via `include_str!`:
```rust
rsx!(
style { {include_str!("./styles.css")} }
// document::Stylesheet { href: asset!("src/styles.css") }
div { id:"overlay",
h2 { "Control Panel" },
button {
onclick: move |_| *show_cube.write() = !show_cube(),
if show_cube() {
"Hide cube"
} else {
"Show cube"
}
}
br {}
ColorControl { label: "Color:", color_str },
p { "This overlay demonstrates that the custom WGPU content can be rendered beneath layers of HTML content" }
}
div { id:"underlay",
h2 { "Underlay" },
p { "This underlay demonstrates that the custom WGPU content can be rendered above layers and blended with the content underneath" }
}
header {
h2 { "Blitz WGPU Demo" }
}
if show_cube() {
SpinningCube { color }
}
)
```
loading .css in the wgpu texture demo via asset!:
```rust
rsx!(
// style { {include_str!("./styles.css")} }
document::Stylesheet { href: asset!("src/styles.css") }
div { id:"overlay",
h2 { "Control Panel" },
button {
onclick: move |_| *show_cube.write() = !show_cube(),
if show_cube() {
"Hide cube"
} else {
"Show cube"
}
}
br {}
ColorControl { label: "Color:", color_str },
p { "This overlay demonstrates that the custom WGPU content can be rendered beneath layers of HTML content" }
}
div { id:"underlay",
h2 { "Underlay" },
p { "This underlay demonstrates that the custom WGPU content can be rendered above layers and blended with the content underneath" }
}
header {
h2 { "Blitz WGPU Demo" }
}
if show_cube() {
SpinningCube { color }
}
)
```
Contributor guide
Assessment
This issue has not been assessed yet.