floem-css 0.2.0

Hot reloading css-like styles for Floem
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#[cfg(not(debug_assertions))]
fn main() {
    println!("cargo::rerun-if-env-changed=STYLE_PATH");
    // Get the path to the file from an environment variable
    let file_path = std::env::var("STYLE_PATH").expect("STYLE_PATH must be set");
    println!("cargo::rerun-if-changed={file_path}");
    // Read the file contents
    let contents = floem_css_parser::read_styles(&file_path.as_ref())
        .expect("Failed to read files from STYLE_PATH");
    // Generate a Rust source file with the contents
    let out_dir = std::env::var("OUT_DIR").unwrap();
    let out_dir = std::path::PathBuf::from(out_dir).join("style.css");
    std::fs::write(out_dir, contents).expect("Build script failed to write combined style.css");
}

#[cfg(debug_assertions)]
fn main() {}