diff --git a/Cargo.toml b/Cargo.toml index 25beb4d33..b231106b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -98,6 +98,12 @@ thiserror = "1.0.40" prettyplease = { package = "prettier-please", version = "0.2", features = [ "verbatim", ] } +manganis-cli-support = { git = "https://github.com/DioxusLabs/collect-assets", rev = "94ea6f7", features = [ + "webp", + "html", +] } +manganis = { git = "https://github.com/DioxusLabs/collect-assets", rev = "94ea6f7" } + # This is a "virtual package" # It is not meant to be published, but is used so "cargo run --example XYZ" works properly @@ -136,8 +142,7 @@ reqwest = { version = "0.11.9", features = ["json"] } env_logger = "0.10.0" simple_logger = "4.0.0" thiserror = { workspace = true } - - -[dependencies] +manganis = { workspace = true } tracing-subscriber = "0.3.17" http-range = "0.1.5" + diff --git a/examples/custom_assets.rs b/examples/custom_assets.rs index 7eb9db375..9f46df924 100644 --- a/examples/custom_assets.rs +++ b/examples/custom_assets.rs @@ -10,7 +10,7 @@ fn app(cx: Scope) -> Element { p { "This should show an image:" } - img { src: mg!(image("examples/assets/logo.png").format(ImageType::Avif)).to_string() } + img { src: manganis::mg!(image("examples/assets/logo.png").format(ImageType::Avif)).to_string() } } }) } diff --git a/examples/file_explorer.rs b/examples/file_explorer.rs index f0534cbf8..3ff757c60 100644 --- a/examples/file_explorer.rs +++ b/examples/file_explorer.rs @@ -18,7 +18,7 @@ fn main() { ); } -const _STYLE: &str = mg!(file("./examples/assets/fileexplorer.css")); +const _STYLE: &str = manganis::mg!(file("./examples/assets/fileexplorer.css")); fn app(cx: Scope) -> Element { let files = use_ref(cx, Files::new); diff --git a/examples/tailwind/Cargo.toml b/examples/tailwind/Cargo.toml index 26ac202f1..f61f1def8 100644 --- a/examples/tailwind/Cargo.toml +++ b/examples/tailwind/Cargo.toml @@ -13,6 +13,7 @@ publish = false [dependencies] dioxus = { path = "../../packages/dioxus" } +manganis = { workspace = true } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] dioxus-desktop = { path = "../../packages/desktop" } diff --git a/examples/tailwind/src/main.rs b/examples/tailwind/src/main.rs index 10124e47c..fe0016651 100644 --- a/examples/tailwind/src/main.rs +++ b/examples/tailwind/src/main.rs @@ -2,7 +2,7 @@ use dioxus::prelude::*; -const _STYLE: &str = mg!(file("./public/tailwind.css")); +const _STYLE: &str = manganis::mg!(file("./public/tailwind.css")); fn main() { #[cfg(not(target_arch = "wasm32"))] diff --git a/examples/todomvc.rs b/examples/todomvc.rs index cdf41aaa0..c891ae832 100644 --- a/examples/todomvc.rs +++ b/examples/todomvc.rs @@ -7,7 +7,7 @@ fn main() { dioxus_desktop::launch(app); } -const _STYLE: &str = mg!(file("./examples/assets/todomvc.css")); +const _STYLE: &str = manganis::mg!(file("./examples/assets/todomvc.css")); #[derive(PartialEq, Eq, Clone, Copy)] pub enum FilterState { diff --git a/packages/cli/Cargo.toml b/packages/cli/Cargo.toml index d22ac7031..ffcd29dc8 100644 --- a/packages/cli/Cargo.toml +++ b/packages/cli/Cargo.toml @@ -76,7 +76,8 @@ toml_edit = "0.19.11" tauri-bundler = { version = "=1.4.*", features = ["native-tls-vendored"] } tauri-utils = "=1.5.*" -manganis-cli-support = { git = "https://github.com/DioxusLabs/collect-assets", features = ["webp", "html"] } +# todo: don't make this optional +manganis-cli-support = { workspace = true, features = ["webp", "html"] } dioxus-autofmt = { workspace = true } dioxus-check = { workspace = true } diff --git a/packages/cli/src/cli/bundle.rs b/packages/cli/src/cli/bundle.rs index a2231b31f..3b0be6ef9 100644 --- a/packages/cli/src/cli/bundle.rs +++ b/packages/cli/src/cli/bundle.rs @@ -136,6 +136,7 @@ impl Bundle { } // Add all assets from collect assets to the bundle + #[cfg(feature = "collect-assets")] { let config = manganis_cli_support::Config::current(); let location = config.assets_serve_location().to_string(); diff --git a/packages/desktop/Cargo.toml b/packages/desktop/Cargo.toml index d7c1bb403..d18b6efa4 100644 --- a/packages/desktop/Cargo.toml +++ b/packages/desktop/Cargo.toml @@ -53,10 +53,7 @@ tao = { version = "0.24.0", features = ["rwh_05"] } [target.'cfg(any(target_os = "windows",target_os = "macos",target_os = "linux",target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))'.dependencies] # This is only for debug mode, and it appears mobile does not support some packages this uses -manganis-cli-support = { git = "https://github.com/DioxusLabs/collect-assets", optional = true, features = [ - "webp", - "html", -] } +manganis-cli-support = { workspace = true, optional = true, features = ["webp", "html"] } rfd = "0.12" global-hotkey = "0.4.1" muda = "0.11.3" @@ -76,7 +73,7 @@ fullscreen = ["wry/fullscreen"] transparent = ["wry/transparent"] devtools = ["wry/devtools"] hot-reload = ["dioxus-hot-reload"] -asset-collect = ["manganis-cli-support"] +collect-assets = ["manganis-cli-support"] gnu = [] [package.metadata.docs.rs] diff --git a/packages/dioxus/Cargo.toml b/packages/dioxus/Cargo.toml index 170f0321e..b88cebe27 100644 --- a/packages/dioxus/Cargo.toml +++ b/packages/dioxus/Cargo.toml @@ -16,7 +16,6 @@ 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 } @@ -37,8 +36,6 @@ criterion = "0.3.5" thiserror = { workspace = true } env_logger = "0.10.0" tokio = { workspace = true, features = ["full"] } -# dioxus-edit-stream = { workspace = true } - [[bench]] name = "jsframework" diff --git a/packages/dioxus/src/lib.rs b/packages/dioxus/src/lib.rs index 1e64715b0..6256e96d7 100644 --- a/packages/dioxus/src/lib.rs +++ b/packages/dioxus/src/lib.rs @@ -22,9 +22,6 @@ 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::*; diff --git a/packages/fullstack/Cargo.toml b/packages/fullstack/Cargo.toml index 17e8ad4f6..05e26a5ef 100644 --- a/packages/fullstack/Cargo.toml +++ b/packages/fullstack/Cargo.toml @@ -69,7 +69,7 @@ web-sys = { version = "0.3.61", features = ["Window", "Document", "Element", "Ht [target.'cfg(any(target_os = "windows",target_os = "macos",target_os = "linux",target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd"))'.dependencies] # This is only for debug mode, and it appears mobile does not support some packages this uses -manganis-cli-support = { git = "https://github.com/DioxusLabs/collect-assets", features = ["webp", "html"] } +manganis-cli-support = { workspace = true, features = ["webp", "html"], optional = true } [features] default = ["hot-reload"] @@ -83,3 +83,4 @@ salvo = ["dep:salvo", "ssr", "http-body-util"] ssr = ["server_fn/ssr", "dioxus_server_macro/ssr", "tokio", "tokio-util", "tokio-stream", "dioxus-ssr", "tower", "hyper", "http", "dioxus-router?/ssr", "tower-layer", "anymap", "tracing-futures", "pin-project", "thiserror"] default-tls = ["server_fn/default-tls"] rustls = ["server_fn/rustls"] +collect-assets = ["manganis-cli-support"]