aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/client-style/Cargo.toml7
-rw-r--r--ui/client-style/src/lib.rs13
2 files changed, 20 insertions, 0 deletions
diff --git a/ui/client-style/Cargo.toml b/ui/client-style/Cargo.toml
index a5db904..935c525 100644
--- a/ui/client-style/Cargo.toml
+++ b/ui/client-style/Cargo.toml
@@ -3,5 +3,12 @@ name = "jellyui-client-style"
version = "0.1.0"
edition = "2024"
+[dependencies]
+glob = { version = "0.3.3", optional = true }
+
[build-dependencies]
glob = "0.3.3"
+
+[features]
+# default = ["reload"]
+reload = ["dep:glob"]
diff --git a/ui/client-style/src/lib.rs b/ui/client-style/src/lib.rs
index 06ddce4..f0c99cf 100644
--- a/ui/client-style/src/lib.rs
+++ b/ui/client-style/src/lib.rs
@@ -5,6 +5,19 @@
*/
use std::borrow::Cow;
+#[cfg(not(feature = "reload"))]
pub fn css_bundle() -> Cow<'static, str> {
include_str!(concat!(env!("OUT_DIR"), "/bundle.css")).into()
}
+
+#[cfg(feature = "reload")]
+pub fn css_bundle() -> Cow<'static, str> {
+ let mut out = String::new();
+ for file in glob::glob("ui/client-style/src/**/*.css")
+ .unwrap()
+ .map(Result::unwrap)
+ {
+ out += &std::fs::read_to_string(file).unwrap();
+ }
+ Cow::Owned(out)
+}