Leaf is a pure Swift templating engine that lets you generate text output, given a template file and a bunch of variables. Leaf can be used by other server-side Swift frameworks and is not specific to HTML rendering. It can be used to generate code or any textual configuration file. In Vapor, it is used to render HTML, and to use Leaf in a Vapor application, we will need to use the Leaf Provider, which, as we learned in previous chapters, implements certain protocols methods needed by Vapor to make a Swift package compatible in order to be consumed.
To understand how Leaf works, let's make a basic Vapor application that uses Leaf to render some text dynamically. The following are the steps to get started with a basic Vapor ...