fn main() { let template = std::fs::read_to_string("templates/index.html") .expect("templates/index.html not found"); tera::Tera::default() .add_raw_template("index.html", &template) .expect("Failed to parse template"); println!("cargo:rerun-if-changed=templates/index.html"); let hash = std::process::Command::new("git") .args(["rev-parse", "--short", "HEAD"]) .output() .ok() .and_then(|o| String::from_utf8(o.stdout).ok()) .map(|s| s.trim().to_string()) .unwrap_or_else(|| "unknown".into()); println!("cargo:rustc-env=SEARCH_HUB_GIT_HASH={}", hash); println!("cargo:rerun-if-changed=.git/HEAD"); }