Make magnansis a feature for examples
This commit is contained in:
2 files changed
+13
-4
No files matched your search
@@ -1,5 +1,11 @@
|
||||
use dioxus::prelude::*;
|
||||
|
||||
#[cfg(not(feature = "collect-assets"))]
|
||||
static ASSET_PATH: &str = "examples/assets/logo.png";
|
||||
|
||||
#[cfg(feature = "collect-assets")]
|
||||
static ASSET_PATH: &str = manganis::mg!(image("examples/assets/logo.png").format(ImageType::Avif));
|
||||
|
||||
fn main() {
|
||||
launch_desktop(app);
|
||||
}
|
||||
@@ -7,10 +13,8 @@ fn main() {
|
||||
fn app() -> Element {
|
||||
rsx! {
|
||||
div {
|
||||
p {
|
||||
"This should show an image:"
|
||||
}
|
||||
img { src: manganis::mg!(image("examples/assets/logo.png").format(ImageType::Avif)).to_string() }
|
||||
p { "This should show an image:" }
|
||||
img { src: ASSET_PATH.to_string() }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user