Created
June 29, 2023 05:34
-
-
Save mcpar-land/b853da913ca7f45faa179704772961ef to your computer and use it in GitHub Desktop.
add tailwind to rust build script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::process::Command; | |
fn main() { | |
let tailwind_cmd = "npx tailwindcss -i input.css -o assets/app.css"; | |
if cfg!(target_os = "windows") { | |
Command::new("cmd").arg("/C").arg(tailwind_cmd).status() | |
} else { | |
Command::new("sh").arg("-c").arg(tailwind_cmd).status() | |
} | |
.expect("error running tailwind"); | |
println!("cargo:rerun-if-changed=tailwind.config.js"); | |
println!("cargo:rerun-if-changed=input.css"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You have the check
status.success()
, because.status()
only returns Err in certain cases (there was something wrong at the system level that disallowed running the command.) Here is my version...Which produces error messages like this...