Closed yubaoquan closed 6 years ago
An advice: there is no need to write a parser for the template, you can just write a java file which compile the template by thymeleaf module and return the result string. And then, include the jar files into node project, node just pass the template path and data to the java module, and receive the compiled result.
There is a freemarker node parser which uses the above approach.
I found thymeleaf offers the similar API with freemarker, it may not be hard to implement.
Support for fragments has been added in version 0.9.0, although the work required by devs to get it working on the client side is less than ideal (a special directory, random webpack configuration). Closing for now as I've raised #16 covering that part of getting fragments to work.
Template fragment is an import feature, it allow user to define a partial template and use it in some other places. For example, I have some stylesheet tags written in many template files, I can extract them into a template fragment, like this:
common.html
and just write this in file which I want to add stylesheets.
See doc here