-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
43 lines (37 loc) · 1.02 KB
/
build.rs
File metadata and controls
43 lines (37 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use std::{fs, process::Command};
fn main() {
// Install Node Dependencies
let output = Command::new("sh")
.arg("-c")
.arg("npm clean-install")
.output()
.unwrap();
// Ensure Node Install worked
if !output.status.success() {
panic!(
"Shell command failed: {}",
String::from_utf8_lossy(&output.stderr)
);
}
// Create Assets directory
fs::create_dir_all("assets/scripts").unwrap();
// Generate TailwindCSS file
let output = Command::new("sh")
.arg("-c")
.arg("npx @tailwindcss/cli -i ./tailwind.css -o ./assets/css/main.css")
.output()
.unwrap();
// Ensure TailwindCSS worked
if !output.status.success() {
panic!(
"Shell command failed: {}",
String::from_utf8_lossy(&output.stderr)
);
}
// Populate Assets directory with HTMX
fs::copy(
"node_modules/htmx.org/dist/htmx.js",
"assets/scripts/htmx.js",
)
.unwrap();
}