summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2024-02-01 22:14:18 +0100
committerRaindropsSys <raindrops@equestria.dev>2024-02-01 22:14:18 +0100
commitce1ba2ab0cf3395c6f28153a9f3aec84da92826f (patch)
treef90bac3eaf5b8aca9dc733a149bb863504f6b87e
parentc1df12ba8f6c86816857a7ef21c55f2aad29b3fe (diff)
downloadviolette-ce1ba2ab0cf3395c6f28153a9f3aec84da92826f.tar.gz
violette-ce1ba2ab0cf3395c6f28153a9f3aec84da92826f.tar.bz2
violette-ce1ba2ab0cf3395c6f28153a9f3aec84da92826f.zip
Updated src/main.rs and added vercel.json (automated)
-rw-r--r--src/main.rs13
-rw-r--r--vercel.json12
2 files changed, 23 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index 62230c8..ea23fc4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -38,10 +38,12 @@ fn main() {
let output_path = PathBuf::from(args.next().unwrap());
let mut output_assets_path = output_path.clone();
let mut output_html_path = output_path.clone();
+ let mut output_404_path = output_path.clone();
let source_assets_path = PathBuf::from("assets");
output_assets_path.push("assets");
output_html_path.push("index.html");
+ output_404_path.push("index.html");
info!("Output directory: {:?}", output_path);
@@ -67,11 +69,18 @@ fn main() {
let markup = generate_template(data);
- let mut file = fs::File::create("./out/index.html").expect("Failed to create the file");
+ let mut file1 = fs::File::create(&output_html_path).expect("Failed to create the index.html file");
+ let mut file2 = fs::File::create(&output_404_path).expect("Failed to create the 404.html file");
info!("Created HTML file {:?}", output_html_path);
- file.write_all(markup.into_string().as_ref()).expect("Failed to write to file");
+ let html_str = markup.into_string();
+ let html = html_str.as_ref();
+
+ file1.write_all(html).expect("Failed to write to index.html file");
info!("Rendered HTML to {:?}", output_html_path);
+ file2.write_all(html).expect("Failed to write to 404.html file");
+ info!("Copied as 404 handler {:?}", output_html_path);
+
info!("All done, bye!");
} \ No newline at end of file
diff --git a/vercel.json b/vercel.json
new file mode 100644
index 0000000..7dbfd5a
--- /dev/null
+++ b/vercel.json
@@ -0,0 +1,12 @@
+{
+ "rewrites": [
+ {
+ "source": "/(.*)",
+ "destination": "/"
+ },
+ {
+ "source": "/assets/(.*)",
+ "destination": "/assets/$1"
+ }
+ ]
+} \ No newline at end of file