blob: 75cc3e283ceb6219bbeede3620f7b1e02686b3fa (
plain)
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
30
31
32
33
34
35
36
37
38
39
40
|
use std::env;
use std::fs;
use std::path::Path;
const THEMES: &[&str] = &["squirrel", "archlinux", "zenburn", "monokai"];
fn main() {
let out_dir = env::var_os("OUT_DIR").expect("OUT_DIR env var missing");
let dest_path = Path::new(&out_dir).join("style.css");
fs::write(
dest_path,
grass::from_path("data/style.scss", &grass::Options::default())
.expect("scss failed to compile"),
)
.expect("failed to write css file");
for theme in THEMES.iter() {
let dest_path = Path::new(&out_dir).join(format!("theme-{}.css", theme));
fs::write(
dest_path,
grass::from_string(
format!(
r#"
@use "data/themes/{theme}";
body:not([data-theme]) {{
@include {theme}.theme();
}}
"#,
theme = theme
),
&grass::Options::default(),
)
.expect("scss failed to compile"),
)
.expect("failed to write css file");
}
println!("cargo:rerun-if-changed=data/style.scss");
}
|