- parse_file
Liquid Hello World read template from file
examples/liquid/liquid-hello-world-from-file/out.txt
Hello Liquid!
examples/liquid/liquid-hello-world-from-file/src/main.rs
fn main() { let filename = String::from("template.txt"); let template = liquid::ParserBuilder::with_stdlib() .build() .unwrap() .parse_file(filename) .unwrap(); let name = String::from("Liquid"); let globals = liquid::object!({ "name": name }); let output = template.render(&globals).unwrap(); println!("{}", output); }
examples/liquid/liquid-hello-world-from-file/template.txt
Hello {{name}}!