dioxus-element-plug 0.1.0

Element UI theme-chalk components for Dioxus applications with built-in SCSS support
use std::env;
use std::fs;
use std::path::Path;

fn main() {
    println!("cargo:rerun-if-changed=src/");
    println!("cargo:rerun-if-changed=../src/"); // Watch SCSS files in parent src directory

    let out_dir = env::var("OUT_DIR").unwrap();
    let dest_path = Path::new(&out_dir).join("theme_chalk_info.rs");

    // Create a file that embeds theme-chalk information
    let theme_info = r#"
// This file is auto-generated by build.rs
pub const THEME_CHALK_VERSION: &str = "1.0.0";
pub const THEME_CHALK_CSS_PATH: &str = "dist/theme-chalk.css";

/// Returns the path to the compiled theme-chalk CSS file
pub fn get_css_path() -> &'static str {
    "dist/theme-chalk.css"
}

/// Returns the version of theme-chalk being used
pub fn get_version() -> &'static str {
    "1.0.0"
}
"#;

    fs::write(&dest_path, theme_info).unwrap();
    println!("cargo:rustc-env=TARGET={}", env::var("TARGET").unwrap());
}