From 09cfec65ece5990a15c979611f06c0d83256206a Mon Sep 17 00:00:00 2001 From: Araozu Date: Sat, 26 Oct 2024 23:13:37 -0500 Subject: [PATCH] fix: add timestamp to tailwind output only on debug --- src/main.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index d11369c..704bde2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -111,12 +111,18 @@ fn index() -> Markup { } fn skeleton(children: Markup) -> Markup { - let ms = SystemTime::now() - .duration_since(UNIX_EPOCH) - .unwrap() - .as_millis(); + // add a timestamp on debug builds + let tailwind_path = if cfg!(debug_assertions) { + let ms = SystemTime::now() + .duration_since(UNIX_EPOCH) + .unwrap() + .as_millis(); + + format!("/public/output.css?t={}", ms) + } else { + String::from("/public/output.css") + }; - let tailwind_path = format!("/public/output.css?t={}", ms); html! { (DOCTYPE) html lang="es" {