ic_pluto_templating/lib.rs
1pub use ructe::RucteError;
2use std::path::PathBuf;
3
4/// This is a method that initializes the templating engine in a Pluto project.
5///
6/// Typically it is meant to be used in a build script (`build.rs` file).
7pub fn initialize_templating_engine(
8 out_dir: PathBuf,
9 templates_dir: &str,
10 static_dir: &str,
11) -> Result<(), ructe::RucteError> {
12 let mut engine = ructe::Ructe::new(out_dir)?;
13 engine.compile_templates(templates_dir)?;
14
15 let mut statics = engine.statics()?;
16 statics.add_files_as(static_dir, "")?;
17 Ok(())
18}