mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-10 06:34:20 +00:00
show off the new asset system in the examples
This commit is contained in:
parent
a647ce2f36
commit
d627153ccc
8 changed files with 14 additions and 9 deletions
|
@ -10,7 +10,7 @@ fn app(cx: Scope) -> Element {
|
|||
p {
|
||||
"This should show an image:"
|
||||
}
|
||||
img { src: "examples/assets/logo.png" }
|
||||
img { src: mg!(image("examples/assets/logo.png").format(ImageType::Avif)).to_string() }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -18,13 +18,14 @@ fn main() {
|
|||
);
|
||||
}
|
||||
|
||||
const _STYLE: &str = mg!(file("./examples/assets/fileexplorer.css"));
|
||||
|
||||
fn app(cx: Scope) -> Element {
|
||||
let files = use_ref(cx, Files::new);
|
||||
|
||||
cx.render(rsx! {
|
||||
div {
|
||||
link { href:"https://fonts.googleapis.com/icon?family=Material+Icons", rel:"stylesheet", }
|
||||
style { include_str!("./assets/fileexplorer.css") }
|
||||
header {
|
||||
i { class: "material-icons icon-menu", "menu" }
|
||||
h1 { "Files: ", files.read().current() }
|
||||
|
|
|
@ -30,7 +30,7 @@ watch_path = ["src", "public"]
|
|||
[web.resource]
|
||||
|
||||
# CSS style file
|
||||
style = ["/tailwind.css"]
|
||||
style = []
|
||||
|
||||
# Javascript code file
|
||||
script = []
|
||||
|
|
1
examples/tailwind/dist/tailwind3531548035813279582.css
vendored
Normal file
1
examples/tailwind/dist/tailwind3531548035813279582.css
vendored
Normal file
File diff suppressed because one or more lines are too long
|
@ -2,13 +2,11 @@
|
|||
|
||||
use dioxus::prelude::*;
|
||||
|
||||
const _STYLE: &str = mg!(file("./public/tailwind.css"));
|
||||
|
||||
fn main() {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
dioxus_desktop::launch_cfg(
|
||||
app,
|
||||
dioxus_desktop::Config::new()
|
||||
.with_custom_head(r#"<link rel="stylesheet" href="public/tailwind.css">"#.to_string()),
|
||||
);
|
||||
dioxus_desktop::launch(app);
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
dioxus_web::launch(app);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@ fn main() {
|
|||
dioxus_desktop::launch(app);
|
||||
}
|
||||
|
||||
const _STYLE: &str = mg!(file("./examples/assets/todomvc.css"));
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Copy)]
|
||||
pub enum FilterState {
|
||||
All,
|
||||
|
@ -47,7 +49,6 @@ pub fn app(cx: Scope<()>) -> Element {
|
|||
|
||||
cx.render(rsx! {
|
||||
section { class: "todoapp",
|
||||
style { include_str!("./assets/todomvc.css") }
|
||||
TodoHeader {
|
||||
todos: todos,
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ dioxus-html = { workspace = true, optional = true }
|
|||
dioxus-core-macro = { workspace = true, optional = true }
|
||||
dioxus-hooks = { workspace = true, optional = true }
|
||||
dioxus-rsx = { workspace = true, optional = true }
|
||||
manganis = { git = "https://github.com/DioxusLabs/collect-assets" }
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
dioxus-hot-reload = { workspace = true, optional = true }
|
||||
|
|
|
@ -22,6 +22,9 @@ pub use dioxus_rsx as rsx;
|
|||
pub use dioxus_core_macro as core_macro;
|
||||
|
||||
pub mod prelude {
|
||||
pub use manganis;
|
||||
pub use manganis::mg;
|
||||
|
||||
#[cfg(feature = "hooks")]
|
||||
pub use crate::hooks::*;
|
||||
|
||||
|
|
Loading…
Reference in a new issue