Skip to content

Static #[used] asset is not included in final build (desktop) #4490

@ronnybremer

Description

@ronnybremer

Problem

Declaring a static asset to be used inside of a CSS file like this

#[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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions