forked from rust-lang-ru/mdBook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.rs
29 lines (22 loc) · 783 Bytes
/
build.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// build.rs
use std::process::Command;
use std::env;
use std::path::Path;
fn main() {
if let Ok(_) = env::var("CARGO_FEATURE_REGENERATE_CSS") {
// Compile stylus stylesheet to css
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
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");
}
}
}