Today I have completed my project atpl.js.

atpl.js (Advanced TemPLates) tried to implement completely the Twig template system, but implementing it in Node.JS instead of PHP. I know a couple of projects that tried  to do the same thing: swig and twig.js.


I started this project something like a year ago, but I decided to give some time to swig and twig.js projects so they could evolve and maybe implementing twig good enough for me. By mid-December 2012, with TypeScript just out, and after checking that swig and twig.js didn’t was mature enough, I decided to resume the work, but this time in TypeScript. And after sometime working on it intermittently since that moment until now, I have been implementing all the Twig functionalities I have constancy of.


atpl.js is fast, very fast. It uses dynamic javascript generation, so the template code ends being converted into native code using javascript V8 engine that uses node. So the performance is excellent and almost imperceptible in comparison of not using templates at all.

Furthermore, I have implemented variable scopes using javascript prototyping, so variable access and blocks is extremely fast.


atpl.js implements all the twig base, starting from conditional multiple-level inheritance, to variable interpolation inside strings, including all operators, macros, horizontal block reusal, all the filters, functions, tests and tags.


atpl.js is being developed completely using TDD (Test Driven Development), using travis-ci to do continuous testing. All the features supported by atpl.js include a unittest that verifies that it is working properly, and every tests is being executed by travis in each commit and release.


atpl.js works with express2 and express3 supports consolidate, and allows to run without additional dependencies.


Right now I’m using atpl.js in several online projects and wip projects without any stability issues. Right now  last version is 0.7.1 that will be 1.0.0 after I end documenting and cleaning up the code and fixing all the possible minor bugs that people would report.

[1] “just a remarkable job… thanks! Finally now I can say that NodeJS have a great templating engine! I’m gonna update my article on my blog! Thanks!”


In order to use atpl.js the only thing you need to install it in your project like any other nodejs module:
npm install atpl

Project website: