Crate trillium_handlebars[][src]

Expand description

Handlebars templating handler for trillium based on the handlebars crate.

use trillium_handlebars::{HandlebarsHandler, HandlebarsConnExt};
let handler = (
    HandlebarsHandler::new("**/*.hbs"),
    |mut conn: trillium::Conn| async move {
        conn.assign("name", "handlebars")
            .render("examples/templates/hello.hbs")
    }
);

use trillium_testing::prelude::*;
assert_ok!(get("/").on(&handler), "hello handlebars!");

Re-exports

pub use handlebars;

Structs

Assigns

A struct for accumulating key-value data for use in handlebars templates. The values can be any type that is serde serializable

Handlebars

The single entry point of your Handlebars templates

HandlebarsHandler

A trillium handler that provides registered templates to downsequence handlers

Traits

HandlebarsConnExt

Extension trait that provides handlebar rendering capabilities to trillium::Conns.