hyperide 0.0.6

Builds strings from embedded HTML in Rust
Documentation
use std::path::Path;

/// Build script to generate tailwind output css on project build. Config should
/// be the path of `tailwind.config.js`, and input should be the path of
/// `input.css`.
pub fn bootstrap(config: &Path, input: &Path) {
    let tw_bin = std::env::var("TAILWINDCSS_BIN").unwrap_or_else(|_| "tailwind".to_string());
    let tw_out = format!("{}/tailwind.out.css", std::env::var("OUT_DIR").unwrap());
    let tw_proc = std::process::Command::new(tw_bin)
        .arg("-c")
        .arg(config)
        .arg("-i")
        .arg(input)
        .arg("-o")
        .arg(tw_out)
        .arg("--minify")
        .status()
        .expect("Tailwind Did Not Run Successfully");
    if !tw_proc.success() {
        panic!("Tailwind Did Not Run Successfully: {tw_proc}");
    }
}

/// A variant of [`crate::include_style!`] that explicitly includes the tailwind
/// output generated by [`bootstrap`]
#[macro_export]
macro_rules! include_tailwind {
    () => {
        $crate::include_style!(concat!(env!("OUT_DIR"), "/tailwind.out.css"))
    };
}

pub use include_tailwind;