generated from alecodes/base-template
24 lines
727 B
Rust
24 lines
727 B
Rust
use std::fs;
|
|
use std::path::Path;
|
|
|
|
fn main() {
|
|
let out_dir = std::env::var("OUT_DIR").unwrap();
|
|
// we only need to bundle the templates with the
|
|
// feature is enabled.
|
|
#[cfg(not(debug_assertions))]
|
|
{
|
|
std::process::Command::new("bun")
|
|
.args(&["vite", "build", "--outDir", &out_dir])
|
|
.status()
|
|
.unwrap();
|
|
minijinja_embed::embed_templates!("frontend/templates");
|
|
}
|
|
|
|
#[cfg(debug_assertions)]
|
|
{
|
|
// dummy file to satisfy the compiler in dev builds
|
|
let dest_path = Path::new(&out_dir).join(".vite/manifest.json");
|
|
fs::create_dir_all(dest_path.parent().unwrap()).unwrap();
|
|
fs::write(&dest_path, "{}").unwrap();
|
|
}
|
|
}
|