2015-09-18 10:05:55 +00:00
|
|
|
// build.rs
|
|
|
|
|
|
|
|
use std::process::Command;
|
|
|
|
use std::env;
|
|
|
|
use std::path::Path;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
2015-09-24 13:37:20 +00:00
|
|
|
if let Ok(_) = env::var("CARGO_FEATURE_REGENERATE_CSS") {
|
2015-09-18 10:05:55 +00:00
|
|
|
|
2015-09-24 13:37:20 +00:00
|
|
|
// Compile stylus stylesheet to css
|
|
|
|
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
2015-09-18 10:05:55 +00:00
|
|
|
|
2015-09-24 13:37:20 +00:00
|
|
|
let theme_dir = Path::new(&manifest_dir).join("src/theme/");
|
|
|
|
let stylus_dir = theme_dir.join("stylus/book.styl");
|
|
|
|
|
|
|
|
if !Command::new("stylus")
|
|
|
|
.arg(format!("{}", stylus_dir.to_str().unwrap()))
|
|
|
|
.arg("--out")
|
|
|
|
.arg(format!("{}", theme_dir.to_str().unwrap()))
|
|
|
|
.arg("--use")
|
|
|
|
.arg("nib")
|
|
|
|
.status().unwrap()
|
|
|
|
.success() {
|
|
|
|
panic!("Stylus encoutered an error");
|
|
|
|
}
|
2015-09-18 20:13:55 +00:00
|
|
|
}
|
2015-09-18 10:05:55 +00:00
|
|
|
|
|
|
|
}
|