diff --git a/.gitignore b/.gitignore index d5ff3f8..054185a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ TODO.md SPEC.md backup.json .env -templates/styles.css \ No newline at end of file +static/css/styles.css \ No newline at end of file diff --git a/build.rs b/build.rs index 8a75394..aa55b0b 100644 --- a/build.rs +++ b/build.rs @@ -20,13 +20,16 @@ fn git_hash() { } fn tailwind() { - // Rerun when any template file changes (Tailwind scans them for classes) + // Rerun when any template or static file changes for entry in walkdir("templates") { println!("cargo:rerun-if-changed={entry}"); } + for entry in walkdir("static") { + println!("cargo:rerun-if-changed={entry}"); + } let mut cmd = Command::new("tailwindcss"); - cmd.args(["-i", "templates/input.css", "-o", "templates/styles.css"]); + cmd.args(["-i", "static/css/input.css", "-o", "static/css/styles.css"]); if std::env::var("PROFILE").as_deref() == Ok("release") { cmd.arg("--minify"); diff --git a/flake.nix b/flake.nix index 81f2373..2943b43 100644 --- a/flake.nix +++ b/flake.nix @@ -54,7 +54,7 @@ buildInputs = [ pkgs.openssl ]; preBuild = '' - tailwindcss -i templates/input.css -o templates/styles.css --minify + tailwindcss -i static/css/input.css -o static/css/styles.css --minify ''; meta = { diff --git a/src/application/routes/mod.rs b/src/application/routes/mod.rs index 5134c83..c5a63ca 100644 --- a/src/application/routes/mod.rs +++ b/src/application/routes/mod.rs @@ -149,35 +149,35 @@ async fn scan_redirect() -> Redirect { async fn styles() -> impl IntoResponse { ( [("content-type", "text/css; charset=utf-8")], - include_str!("../../../templates/styles.css"), + include_str!("../../../static/css/styles.css"), ) } async fn webauthn_js() -> impl IntoResponse { ( [("content-type", "application/javascript; charset=utf-8")], - include_str!("../../../templates/webauthn.js"), + include_str!("../../../static/js/webauthn.js"), ) } async fn photo_capture_js() -> impl IntoResponse { ( [("content-type", "application/javascript; charset=utf-8")], - include_str!("../../../templates/components/photo-capture.js"), + include_str!("../../../static/js/components/photo-capture.js"), ) } async fn searchable_select_js() -> impl IntoResponse { ( [("content-type", "application/javascript; charset=utf-8")], - include_str!("../../../templates/components/searchable-select.js"), + include_str!("../../../static/js/components/searchable-select.js"), ) } async fn favicon() -> impl IntoResponse { ( [("content-type", "image/x-icon")], - include_bytes!("../../../templates/favicon.ico").as_ref(), + include_bytes!("../../../static/favicon.ico").as_ref(), ) } diff --git a/templates/input.css b/static/css/input.css similarity index 99% rename from templates/input.css rename to static/css/input.css index 122e71a..a680140 100644 --- a/templates/input.css +++ b/static/css/input.css @@ -1,5 +1,6 @@ @import "tailwindcss"; -@source "./"; +@source "../../templates/"; +@source "../../static/js/"; /* ── Dark mode variant (selector-based) ────────────────────────── */ diff --git a/templates/favicon.ico b/static/favicon.ico similarity index 100% rename from templates/favicon.ico rename to static/favicon.ico diff --git a/templates/components/photo-capture.js b/static/js/components/photo-capture.js similarity index 100% rename from templates/components/photo-capture.js rename to static/js/components/photo-capture.js diff --git a/templates/components/searchable-select.js b/static/js/components/searchable-select.js similarity index 100% rename from templates/components/searchable-select.js rename to static/js/components/searchable-select.js diff --git a/templates/webauthn.js b/static/js/webauthn.js similarity index 100% rename from templates/webauthn.js rename to static/js/webauthn.js