javalin / javalin-rendering

Artifact/module for server-side template/markdown rendering in Javalin: https://javalin.io/plugins/rendering
Apache License 2.0
10 stars 7 forks source link

Inconsistent default behavior of Jte renderer #23

Open dzikoysk opened 1 year ago

dzikoysk commented 1 year ago

As stated in the official rendering plugin docs, the default location of templates for each implementation is "src/resources/templates" directory.

This is not the case for Jte implementation:

https://github.com/javalin/javalin-rendering/blob/85af5d55a8149c362a922d34773dd8484112259d/src/main/java/io/javalin/rendering/template/JavalinJte.kt#L50

The default behavior of the Jte impl is to search in the ./src/main/jte directory, so it won't load templates from app resources & it won't work by default, if you'll override working directory for your process. The default impl should use this engine:

TemplateEngine.create(ResourceCodeResolver("templates"), ContentType.Html)