brass/build.rs

40 lines
996 B
Rust

use static_files::{resource_dir, NpmBuild};
use std::{
fs::{self, copy},
path::Path,
};
fn main() -> std::io::Result<()> {
NpmBuild::new("./static").change_detection().install()?;
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()
}