Reading this post I was a bit interested on applying another template engines and that was a surprise for me that this could be made without using java. I’ve implemented Twig using TwigJS library with success needing few small changes. This is really nice, since in my company the projects are in Enonic or eZ Publish, developers prefer this instead of Thymeleaf.
As result, I have a page that in full thymeleaf lasts 4.000ms to load and 2.800ms in Twig (40% faster to render the same page!).
For anyone that gets interested, I had to:
put “twig”, “path” and “fs” (npm packages) on the lib folder;
Did you try XP 6.6 it has the upgraded version 3 of thymeleaf. It is supposed to be faster. Would be interesting to see if it improves speed on your usecase?
@aro, @tsi, @srs thanks for the responses.I’ll talk to the guys here about creating a starter for it I think should be useful for everyone too. About enonic version, it was on 6.6.
This is really cool!! I have a few questions, though.
fs is not an npm package, it comes with the Node binary. Did you pull it directly from Node’s source code to add it to the lib folder, or did you add some other npm package?
path uses the process object, which is also not available in Nashorn (as far as I know anyway). You mention that you only had to rename the file to index.js, but this should result in an error. Did you modify the source to get things working, or am I missing something here?
No, I hadn’t to change source code. I’ve just executed “npm install path” and “npm install fs”, so I get these packages, even if they are already in Node Installation. The downloaded packages on node_modules were then moved to the lib folder and after the changes I described here they were working