You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let’s try to render our first template. Create the directory src/main/jte in your project. In this directory create a file hello.jte and enter the following:
The guide points to "src/main/jte", like it'd be a new sources dir for Gradle/Maven, but to be more precise, it's a directory relative to the app's working directory. It means that if we'd change workdir of a given process, it won't work anymore like it was desired by tutorial & jte renderer author
This behavior is inconsistent with how other renderers work, so maybe it should be somehow highlighted with a note how to handle templates from resources
private fun createTemplateEngine(): TemplateEngine {
return if (isDevSystem) {
val codeResolver = DirectoryCodeResolver(Path.of("src", "main", "jte"))
TemplateEngine.create(codeResolver, ContentType.Html)
} else {
TemplateEngine.createPrecompiled(Path.of("jte-classes"), ContentType.Html)
}
}
Explain the difference between DirectoryCodeResolver/ResourceCodeResolver that is a key part for dev env. Explain that DirectoryCodeResolver handles relative path to local fs that depends on current workdir of app process (it may be needed once the src/resources/templates will become the default dir for jte renderer javalin/javalin-rendering#23)
It should reflect changes from javalin/javalin-rendering#23
Explain the difference between
DirectoryCodeResolver
/ResourceCodeResolver
that is a key part for dev env. Explain thatDirectoryCodeResolver
handles relative path to local fs that depends on current workdir of app process (it may be needed once thesrc/resources/templates
will become the default dir for jte renderer javalin/javalin-rendering#23)https://github.com/casid/jte/blob/main/DOCUMENTATION.md#gradle
The text was updated successfully, but these errors were encountered: