mirror of
https://github.com/rust-lang/mdBook
synced 2024-12-14 23:02:34 +00:00
75bbd55128
Updated the project rustfmt.toml to include `use_try_shorthand = true`. Run rustfmt on all rust sources.
30 lines
800 B
Rust
30 lines
800 B
Rust
// 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");
|
|
}
|
|
}
|
|
|
|
}
|