2 Additionnal build, doc: https://doc.rust-lang.org/cargo/reference/build-scripts.html
5 - Compile the SASS file to CSS file.
11 process
::{Command
, Output
},
14 fn exists_in_path
<P
>(filename
: P
) -> bool
18 for path
in env
::split_paths(&env
::var_os("PATH").unwrap()) {
19 if path
.join(&filename
).is_file() {
27 println!("cargo:rerun-if-changed=style.scss");
29 fn run_sass(command
: &mut Command
) -> Output
{
32 .arg("static/style.css")
34 .expect("Unable to compile SASS file, install SASS, see https://sass-lang.com/")
37 let output
= if exists_in_path("sass.bat") {
38 run_sass(Command
::new("cmd").args(&["/C", "sass.bat"]))
40 run_sass(&mut Command
::new("sass"))
43 if !output
.status
.success() {
44 // SASS will put the error in the file.
46 std
::fs
::read_to_string("./static/style.css").expect("unable to read style.css");