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;
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