The tulip.pkg.template
module exports the template
package. It uses
the lua-resty-template module.
#Configuration
- root_path: string = path to the root directory of templates
#API Extensions
Registering this package provides the following method and field extensions.
#s, err = App:render(path, ctx)
Renders a template using the provided context.
Args:
- path: string = the path to the view, if a root_path was configured,
this is relative to that path.
- ctx: table = the context to execute the template. If the app.locals
field exist, it is added as ctx.locals, with any existing ctx.locals
values overriding the app's.
Returns:
- s: string = the rendered template
- err: Error|nil = the error message if s is falsy
Back to index