9ae79dee296ec8a2703f7346968f6b88500ab320
2 Additionnal build, doc: https://doc.rust-lang.org/cargo/reference/build-scripts.html
5 - Compile the SASS file to CSS file.
8 use std
::{ env
, process
::{ Command
, Output
}, path
::Path
};
10 fn exists_in_path
<P
>(filename
: P
) -> bool
11 where P
: AsRef
<Path
> {
12 for path
in env
::split_paths(&env
::var_os("PATH").unwrap()) {
13 if path
.join(&filename
).is_file() { return true; }
19 println!("cargo:rerun-if-changed=style.scss");
21 fn run_sass(command
: &mut Command
) -> Output
{
24 .arg("static/style.css")
26 .expect("Unable to compile SASS file, install SASS, see https://sass-lang.com/")
30 if exists_in_path("sass.bat") {
31 run_sass(Command
::new("cmd").args(&["/C", "sass.bat"]))
33 run_sass(&mut Command
::new("sass"))
36 if !output
.status
.success() {
37 // SASS will put the error in the file.
38 let error
= std
::fs
::read_to_string("./static/style.css").expect("unable to read style.css");