Niro* by cho45

#21 micro-template.js JavaScript Template Engine

Released first version of micro-template.js to npm: https://npmjs.org/micro-template (repository: http://github.com/cho45/micro-template.js ). Of Course, you can use this in HTML pages.

This is inspired from John Resig's JavaScript Micro-Templating. It is awesome because very leverage small code. But wrote from scratch as following reason:

  • Better error messages: show line-number in runtime errors
  • Support source map: debug is more easily on Chrome including syntax errors
  • Well tested: tested on node.js
  • Escape by default: all output is escaped by default for security

And, as a result, more faster:

micro-template.js: 2156.721782890007 counts/sec
John Resig's tmpl: 1371.7421124828534 counts/sec
micro-template.js (escaped): 1874.414245548266 counts/sec

Of Course, this is still very small code. 27 lines: https://github.com/cho45/micro-template.js/blob/master/lib/micro-template.js

I love leverage. Enjoy.

blog comments powered by Disqus
login