atpl.js: completed my twig implementation for #nodejs #twig

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.

History:

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.

Performance:

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.

Implementation:

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.

Development:

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.

Integration:

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

Status:

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.

Opinions:
[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!”

Usage:

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: https://github.com/soywiz/atpl.js