DioxusLabs / DioxusLabs/dioxus
Static #[used] asset is not included in final build (desktop)
- Dominant language
- Rust
- Stars
- 39.1k
- Forks
- 1.9k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 4
Description
**Problem**
Declaring a static asset to be used inside of a CSS file like this
```rust
#[used]
static _FONTS: Asset = asset!(
"/assets/fonts/webfonts/fa-solid-900.woff2",
AssetOptions::builder()
.with_hash_suffix(false)
.into_asset_options()
);
```
`dx` will not export this font into the `asset` folder. In `verbose` mode during compile `dx` finds all other assets (which are referenced), but not the one declared above.
Pull request #4312 is merged into 0.7.0-alpha.3 but somehow the linker ignores that asset.
**Steps To Reproduce**
Steps to reproduce the behavior:
- declare a static asset!
- declare an asset! directly `document::Stylesheet { href: asset!("/assets/css/patternfly.css", AssetOptions::builder().with_hash_suffix(false).into_asset_options()) }`
- run dx serve in verbose mode
- observe the log output `16:50:20 [dev] Found asset at offset 25376800: BundledAsset { absolute_source_path: "/home/dev/test/assets/css/patternfly.css", bundled_path: "this is a placeholder path which will be replaced by the linker", options: AssetOptions { add_hash: false, variant: Unknown } }`
- the same line does not get logged for the static asset
**Expected behavior**
The static asset should be found and included in the `assets` folder during the build.
**Screenshots**
**Environment:**
- Dioxus version: 0.7.0-alpha.3
- Rust version: 1.88.0
- OS info: Debian Bookworm
- App platform: desktop
**Questionnaire**
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.