dioxus-element-plug 0.1.4

Element UI components for Dioxus applications with pure Rust styling system
use std::env;
use std::fs;
use std::path::Path;

fn main() {
    // Skip build script execution during docs.rs documentation generation
    // to prevent issues with asset processing and file system access
    if env::var("DOCS_RS").is_ok() {
        println!("cargo:warning=Skipping build script during docs.rs documentation generation");
        return;
    }

    println!("cargo:rerun-if-changed=src/");
    // Only watch parent directory if not building documentation
// SCSS directory removed - using pure Rust styles

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

    // Embed Rust styling system information
    let theme_info = r#"
// This file is auto-generated by build.rs
pub const RUST_STYLES_VERSION: &str = "1.0.0";
pub const GENERATED_STYLES_PATH: &str = "src/generated_styles.rs";

/// Returns information about the Rust styling system
pub fn get_version() -> &'static str {
    "1.0.0"
}

/// Indicates this is using pure Rust styling (no SCSS)
pub const IS_PURE_RUST: bool = true;
"#;

    if let Err(e) = fs::write(&dest_path, theme_info) {
        // Gracefully handle write errors during documentation builds
        println!("cargo:warning=Failed to write theme info file: {}", e);
        return;
    }
    
    if let Ok(target) = env::var("TARGET") {
        println!("cargo:rustc-env=TARGET={}", target);
    }
}