add flowbite
This commit is contained in:
parent
caeac280eb
commit
5ef37275ec
4 changed files with 48 additions and 8 deletions
26
build.rs
26
build.rs
|
@ -1,11 +1,9 @@
|
|||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
fn main() {
|
||||
let url = "https://unpkg.com/htmx.org@2.0.4/dist/htmx.min.js";
|
||||
let dest_path = Path::new("src/htmx.min.js");
|
||||
|
||||
println!("Downloading htmx.min.js from {url}");
|
||||
pub fn download_file(url: &str, dest_path: &str) {
|
||||
println!("Downloading {dest_path} from {url}");
|
||||
let dest_path = Path::new(dest_path);
|
||||
let response = reqwest::blocking::get(url)
|
||||
.expect("Failed to send HTTP request")
|
||||
.error_for_status()
|
||||
|
@ -13,7 +11,23 @@ fn main() {
|
|||
|
||||
let content = response.bytes().expect("Failed to read response body");
|
||||
|
||||
fs::write(dest_path, &content).expect("Failed to write htmx.min.js to destination");
|
||||
fs::write(dest_path, &content).expect("Failed to write file to destination");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
download_file(
|
||||
"https://unpkg.com/htmx.org@2.0.4/dist/htmx.min.js",
|
||||
"src/htmx.min.js",
|
||||
);
|
||||
|
||||
download_file(
|
||||
"https://cdn.jsdelivr.net/npm/flowbite@2.5.2/dist/flowbite.min.css",
|
||||
"src/flowbite.min.css",
|
||||
);
|
||||
download_file(
|
||||
"https://cdn.jsdelivr.net/npm/flowbite@2.5.2/dist/flowbite.min.js",
|
||||
"src/flowbite.min.js",
|
||||
);
|
||||
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue