Open checketts opened 3 months ago
Hi @checketts, I'm the author of jte-models. I'm kinda busy but I will try to get back to you at the weekend.
Thanks for the jte-models
!
Here is my imagined way of making it work:
//Generate HTML based templates
jteExtension("gg.jte.models.generator.ModelExtension") {
property("language", "Kotlin")
property("excludePattern", ".*_text.*")
}
//Generate Text based templates
jteExtension("gg.jte.models.generator.ModelExtension") {
property("language", "Kotlin")
property("package", "gg.jte.generated.precompiled.text") // Will place the `Templates` classes in this package
property("contentType", "plain")
property("includePattern", ".*_text.*")
}
Note the new package
and contentType
options.
jte-models can generate models for plain text templates. It uses the contentType
specified on the jte { }
block in Gradle.
This does make it difficult to use both HTML and plain templates at the same time. I think you would have to put them in separate submodules.
Sorry for the delay in responding, by the way.
It would not be too hard to make your imagined configuration work, but it would require some code changes.
Thanks for the response. My usecase is generating emails, since email has an HTML envelope and a plaintext. So separate modules wouldn't necessarily work for me.
Are you aware of a way to pass separate jteExtension
config to a separate Gradle task? Perhaps I could investigate that route.
The JTE Gradle plugin currently makes some assumptions that will prevent you configuring a separate task with different settings. It would be good to fix, but I don't have time available to work on that at the moment.
In following the JteModels documentation I seem to be able to only create Html based templates.
However, I need to create a few text (plain) templates.
Does that support exist? Any hint on how that might be configured?
I'll be happy to provide a PR for the docs once I figure out what is missing...