advent of atproto
at feature/UIChanges 49 lines 1.4 kB view raw
1use std::process::Command; 2 3fn main() { 4 std::fs::create_dir_all("build").expect("failed to create build directory"); 5 6 Command::new("npx") 7 .args([ 8 "@tailwindcss/cli", 9 "-m", 10 "-i", 11 "assets/css/base.css", 12 "-o", 13 "public/css/style.css", 14 ]) 15 .status() 16 .expect("failed to run tailwindcss"); 17 18 // Command::new("bun") 19 // .args([ 20 // "build", 21 // "--minify", 22 // "--outdir=build", 23 // "--entry-naming", 24 // "[name].[hash].[ext]", 25 // "--asset-naming", 26 // "[name].[hash].[ext]", 27 // "./assets/scripts/index.ts", 28 // ]) 29 // .status() 30 // .expect("failed to run bun"); 31 32 copy_files("public"); 33} 34 35fn copy_files(dir: &str) { 36 for entry in std::fs::read_dir(dir).expect("failed to read dir `public`") { 37 let entry = entry.expect("failed to read entry"); 38 39 if entry.file_type().unwrap().is_dir() { 40 copy_files(entry.path().to_str().unwrap()); 41 } else { 42 let path = entry.path(); 43 let filename = path.file_name().unwrap().to_str().unwrap(); 44 let dest = format!("build/{}", filename); 45 46 std::fs::copy(path, dest).expect("failed to copy file"); 47 } 48 } 49}