Skip to content

Instance Method

render(path:context:)

The public interface to LeafRenderer
func render(path: String, context: [String : LeafData]) -> EventLoopFuture<ByteBuffer>

Parameters

path

Name of the template to be used

context

Any unique context data for the template to use

Return Value

Serialized result of using the template, or a failed future

Discussion

Interpretation of path is dependent on the implementation of LeafSource but is assumed to be relative to LeafConfiguration.rootDirectory.

Where LeafSource is a file sytem based source, some assumptions should be made; .leaf extension should be inferred if none is provided- "path/to/template" corresponds to "/.../ViewDirectory/path/to/template.leaf", while an explicit extension - "file.svg" would correspond to "/.../ViewDirectory/file.svg"