-
I'm currently working on a Tailwind + Dioxus proof of concept, and I was trying to get a I'm curious if there's a feature for bundling stable assets like this, or if this is an XY problem that I should be approaching in a completely different way. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Unfortunately, the only way to do this currently is to use our deprecated (but not yet removed) [application]
asset_dir = "assets" and the asset would be referenced by URL |
Beta Was this translation helpful? Give feedback.
-
I just had the same issue and tried to work around this using a custom style component that renders font-face definitions to the head: #[component]
fn FontFace(family: &'static str, style: &'static str, weight: usize, asset: Asset) -> Element {
rsx! {
document::Style {{
format!("
@font-face {{
font-display: swap;
font-family: '{}';
font-style: {};
font-weight: {};
src: url('{}') format('woff2');
}}
", family, style, weight, asset
)
}}
}
} FontFace {
family: "Noto Sans",
style: "normal",
weight: 400,
asset: asset!("/assets/noto-sans-regular.woff2")
} This somehow worked, but has its own quirks. I'll try the deprecated |
Beta Was this translation helpful? Give feedback.
Unfortunately, the only way to do this currently is to use our deprecated (but not yet removed)
asset_dir
option inDioxus.toml
and the asset would be referenced by URL
/assets/yourasset
Here are some related issues: #3767 & #3325