From 930e7bc8516355f31df6d6cd51baae1824c25340 Mon Sep 17 00:00:00 2001 From: Valerio Ageno Date: Thu, 30 May 2024 21:03:09 +0200 Subject: [PATCH] feat: filter reload trigger files --- crates/tuono/src/watch.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/crates/tuono/src/watch.rs b/crates/tuono/src/watch.rs index 23c63ccd..e41b7c73 100644 --- a/crates/tuono/src/watch.rs +++ b/crates/tuono/src/watch.rs @@ -53,13 +53,17 @@ pub async fn watch() -> Result<()> { let wx = Watchexec::new(move |mut action| { for event in action.events.iter() { - for _ in event.paths() { - run_server.stop(); - println!("Reloading server..."); - build_ssr_bundle.stop(); - build_ssr_bundle.start(); - bundle_axum_source(); - run_server.start(); + for path in event.paths() { + if path.0.to_string_lossy().ends_with(".rs") + || path.0.to_string_lossy().ends_with("sx") + { + run_server.stop(); + println!("Reloading server..."); + build_ssr_bundle.stop(); + build_ssr_bundle.start(); + bundle_axum_source(); + run_server.start(); + } } }