Structure
PlaintextRenderer
A
ViewRenderer that serves views from files on disk, without any templating.struct PlaintextRenderer
Overview
PlaintextRenderer reads the requested file from its configured views directory and returns its raw contents as a View. The context passed to render(_:_:) is ignored as no template substitution is performed.
This renderer is mainly used for testing. Its use in production is discouraged. Consider using Leaf if you need a real templating engine.
Topics
Initializers
init(viewsDirectory: String)Creates a newPlaintextRenderer.
Instance Methods
func `for`(Request) -> any ViewRendererReturns the renderer for the given request, with the logger set from theRequest.func render<E>(String, E) async throws -> ViewRenders a view by returning the contents of the file.
Relationships
Conforms To
Swift.SendableSwift.SendableMetatypeViewRenderer