brass/build.rs

42 lines
1.1 KiB
Rust

use static_files::{resource_dir, NpmBuild};
use std::{
fs::{self, copy},
path::Path,
};
fn main() -> std::io::Result<()> {
built::write_built_file().expect("Failed to acquire build-time information");
NpmBuild::new("./static").change_detection().install()?.run("build-bulma")?;
let dist_path = Path::new("./static/dist");
let nm_path = Path::new("./static/node_modules");
if fs::metadata(dist_path).is_err() {
fs::create_dir(dist_path)?;
}
copy(
nm_path.join("feather-icons/dist/feather-sprite.svg"),
dist_path.join("feather-sprite.svg"),
)?;
//copy(
// nm_path.join("bulma/css/bulma.min.css"),
// dist_path.join("bulma.min.css"),
//)?;
copy(
nm_path.join("htmx.org/dist/htmx.min.js"),
dist_path.join("htmx.min.js"),
)?;
copy(
nm_path.join("htmx.org/dist/ext/response-targets.js"),
dist_path.join("response-targets.js"),
)?;
copy(
Path::new("./static/brass.jpeg"),
dist_path.join("brass.jpeg"),
)?;
resource_dir("./static/dist").build()
}