Skip to content

Commit 8e27527

Browse files
committed
WIP generate site statically
1 parent ec69977 commit 8e27527

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
/static/styles/vendor*.css
99
/static/styles/app*.css
1010
/static/styles/fonts*.css
11+
/public

src/main.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,21 @@ fn render_subject(category: Category, subject: &str, lang: String) -> Result<Tem
406406

407407
#[rocket::launch]
408408
async fn rocket() -> _ {
409+
fs::remove_dir_all("public").ok();
410+
fs::create_dir_all("public").unwrap();
411+
412+
// index
413+
async fn index(version_cache: &Cache<RustVersion>) -> Template {
414+
render_index(ENGLISH.into(), version_cache).await
415+
}
416+
417+
// /logos/<file..>
418+
fs::create_dir_all("public/logos").unwrap();
419+
for file in fs::read_dir("static/logos").unwrap().map(Result::unwrap) {
420+
let name = file.file_name().into_string().unwrap();
421+
fs::copy(file.path(), format!("public/logos/{name}")).unwrap();
422+
}
423+
409424
let templating = Template::custom(|engine| {
410425
engine
411426
.handlebars

0 commit comments

Comments
 (0)