fix(build): always regenerate CSS on every cargo build

Remove all rerun-if-changed directives so Cargo runs the build
script unconditionally, ensuring tailwindcss always regenerates
styles.css without manual steps.
This commit is contained in:
Jon Seager 2026-02-06 12:32:21 +00:00
parent b68748da14
commit db786c8387
No known key found for this signature in database

View file

@ -15,23 +15,9 @@ fn git_hash() {
.unwrap_or_default();
let hash = output.trim();
println!("cargo:rustc-env=GIT_HASH={hash}");
println!("cargo:rerun-if-changed=.git/HEAD");
println!("cargo:rerun-if-changed=.git/refs/heads/");
}
fn tailwind() {
// Rerun when any template or static file changes
for entry in walkdir("templates") {
println!("cargo:rerun-if-changed={entry}");
}
for entry in walkdir("static") {
// Skip the generated output file to avoid circular rebuilds
if entry == "static/css/styles.css" {
continue;
}
println!("cargo:rerun-if-changed={entry}");
}
let mut cmd = Command::new("tailwindcss");
cmd.args(["-i", "static/css/input.css", "-o", "static/css/styles.css"]);
@ -52,22 +38,3 @@ fn tailwind() {
}
}
}
fn walkdir(dir: &str) -> Vec<String> {
let mut files = Vec::new();
let mut stack = vec![std::path::PathBuf::from(dir)];
while let Some(path) = stack.pop() {
let Ok(entries) = std::fs::read_dir(&path) else {
continue;
};
for entry in entries.flatten() {
let path = entry.path();
if path.is_dir() {
stack.push(path);
} else {
files.push(path.display().to_string());
}
}
}
files
}