Browse Source

Load tera templates at compile-time

master
Stephen 2 weeks ago
parent
commit
34124b97da
1 changed files with 9 additions and 7 deletions
  1. +9
    -7
      src/frontend.rs

+ 9
- 7
src/frontend.rs View File

@ -5,13 +5,15 @@ use tera::Tera;
lazy_static! {
pub static ref TEMPLATES: Tera = {
match Tera::new("templates/**/*") {
Ok(t) => t,
Err(e) => {
println!("Parsing error(s): {}", e);
::std::process::exit(1);
}
}
let mut tera = Tera::default();
tera.add_raw_templates(vec![(
"project.html",
include_str!("../templates/project.html"),
)])
.unwrap();
tera
};
}


Loading…
Cancel
Save