Using Stringtemplate for generating HTML pages from templates with Maven
I have a relatively simple web app, which uses basic HTML pages with Ajax (using jQuery, bit of Javascript) to access data from a web service and render it. So far so good. But since there are commonalities between the pages (the usual stuff, headers etc), I would love to templatize. But given static nature of templating I would like to do this as part of the build process and not dynamically, just so that what is deployed for GUI is strictly just bunch of static resources (HTML, css, javascript libs).
Stringtemplate (http://www.stringtemplate.org/) looks like a very elegant templating engine that would probably work well. But while I could easily write bit of Java to invoke it, I was hoping to find an existing Maven plug-in that would allow me 开发者_如何学运维to automate the whole building and packaging process. I wasn't able to find such thing, but was hoping that others might know of something similar?
UPDATE: looks like while Stringtemplate has its benefit, some things are not particularly easy with it; say, inclusion of HTML snippet files. So I am thinking of looking at other options (FreeMarker, MiniTemplator, maybe even Velocity)
Ok, looks like there wasn't.
I did create a new Github project, maven-stringtemplate-plugin, for what that's worth, although I am not actually sure if I will use Stringtemplate for this particular purpose. But it might work for other kinds of use cases.
精彩评论