diff --git a/src/bin.rs b/src/bin.rs index 845a3ae..84fe456 100644 --- a/src/bin.rs +++ b/src/bin.rs @@ -39,18 +39,20 @@ fn main() { (p.to_string(), template_content) }) .collect(); - // let compiled_templates: Vec = template_contents - // .iter() - // .map(|(p, contents)| template_from_file(p, contents)) - // .collect(); - // let mut dust_renderer = DustRenderer::new(); - // compiled_templates.iter().for_each(|template| { - // dust_renderer.load_source(template); - // }); - // let main_template_name = &compiled_templates - // .first() - // .expect("There should be more than 1 template") - // .name; + let compiled_templates_result: Result, CompileError> = + template_contents + .iter() + .map(|(p, contents)| template_from_file(p, contents)) + .collect(); + let compiled_templates = compiled_templates_result.unwrap(); + let main_template_name = &compiled_templates + .first() + .expect("There should be more than 1 template") + .0; + let mut dust_renderer = DustRenderer::new(); + compiled_templates.iter().for_each(|(name, template)| { + dust_renderer.load_source(template, name.to_owned()); + }); // let breadcrumbs = vec![&context as &dyn IntoContextElement]; // println!( // "{}",