brewlog/build.rs
Jon Seager 3a960b9d14
feat(ui): enhance desktop tables and mobile card views
- Add spacious flat table CSS for desktop (transparent card wrapper,
  lighter dividers, visible hover, larger cell padding)
- Split roaster/cafe columns into separate Country and City columns
  with sortable headers
- Split cup Roast/Roaster into separate desktop columns with city
  sort support (full-stack: domain, repo, view, template)
- Add sortable Status column to bags with colored pills (green Open,
  amber Closed) and remaining weight subtext
- Style bag Finished column as date-only (NaiveDate) and Weight
  column with smaller text
- Show status pill next to mobile bag card actions menu
- Add city to cups mobile card view
- Use middle dot separator for brew recipe weight/volume
- Add tasting notes pills to roast list, brew notes to brew list
- Fix build.rs to use rerun-if-changed for CSS and templates
2026-02-06 15:40:40 +00:00

51 lines
1.4 KiB
Rust

use std::path::Path;
use std::process::Command;
fn main() {
git_hash();
tailwind();
}
fn git_hash() {
let output = Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output()
.ok()
.filter(|o| o.status.success())
.and_then(|o| String::from_utf8(o.stdout).ok())
.unwrap_or_default();
let hash = output.trim();
println!("cargo:rustc-env=GIT_HASH={hash}");
}
fn tailwind() {
println!("cargo:rerun-if-changed=static/css/input.css");
println!("cargo:rerun-if-changed=templates/");
let mut cmd = Command::new("tailwindcss");
cmd.args(["-i", "static/css/input.css", "-o", "static/css/styles.css"]);
if std::env::var("PROFILE").as_deref() == Ok("release") {
cmd.arg("--minify");
}
let output = Path::new("static/css/styles.css");
match cmd.status() {
Ok(status) if status.success() => {}
Ok(status) => {
eprintln!("cargo:warning=tailwindcss exited with {status}");
}
Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
eprintln!("cargo:warning=tailwindcss not found on PATH, skipping CSS generation");
}
Err(e) => {
eprintln!("cargo:warning=failed to run tailwindcss: {e}");
}
}
// Ensure the file exists so include_str!() doesn't break the build
if !output.exists() {
std::fs::write(output, "/* tailwindcss not available */").ok();
}
}