简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM