Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I877f0856ac5392266a9ba4f607a8d73c6a6a6964
33 lines
916 B
Rust
33 lines
916 B
Rust
#![expect(
|
|
clippy::expect_used,
|
|
reason = "build scripts conventionally panic on failure; there is no caller \
|
|
to propagate errors to"
|
|
)]
|
|
|
|
use std::{fs, path::Path};
|
|
|
|
fn main() {
|
|
// Compile SCSS to CSS
|
|
let scss_dir = Path::new("assets/styles");
|
|
let css_dir = Path::new("assets/css");
|
|
|
|
// Create CSS output directory if it doesn't exist
|
|
fs::create_dir_all(css_dir).expect("Failed to create CSS directory");
|
|
|
|
// Compile main.scss
|
|
let scss_input = scss_dir.join("main.scss");
|
|
let css_output = css_dir.join("main.css");
|
|
|
|
if scss_input.exists() {
|
|
let css = grass::from_path(
|
|
&scss_input,
|
|
&grass::Options::default().style(grass::OutputStyle::Compressed),
|
|
)
|
|
.expect("Failed to compile SCSS");
|
|
|
|
fs::write(&css_output, css).expect("Failed to write CSS");
|
|
|
|
// Tell cargo to rerun if SCSS files change
|
|
println!("cargo:rerun-if-changed=assets/styles");
|
|
}
|
|
}
|