Liquid Hello World read template from file



Hello Liquid!



examples/liquid/liquid-hello-world-from-file/src/main.rs
fn main() {
    let filename = "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}}!