I saw it used in a project once and it was a disaster. The problem being, by using javascript to represent html you are making your templates harder to write and harder to maintain.
This solution certainly has some cool features, but I strongly disagree with comparisons to haml. Where haml strips away a bunch of html syntactical weight, newt.js piles it on.
Sorry if i'm being too strong, but I just wanted to share my thoughts/experiences/criticism. It is clear the author has put a lot of work into this, including tests.
I like http://www.handlebarsjs.com/ for my javascript templating because I can literally cut and paste in some html into a template, add some logic(if/then blocks) and I'm done.
I started coming to a similar conclusion about pure-JavaScript templating in terms of ease of writing and maintenance after getting most of the way into implementing a templating plugin for my DOMBuilder library, based on this speculative API extracted from a sample Django template: https://gist.github.com/958838
Once you start piling on the mixed, nested content and a mix of elements with and without attributes, it takes some diligence to ensure you've put all your commas and parentheses in the right place first time, and the resulting code isn't all that pleasing on the eye when you compare it to the usual HTML with placeholders for logic/dynamic content.
I still find this style of templating useful for smaller chunks of content like this sort of thing, though:
I don't think you're being too harsh. I agree that newT really doesn't seem like a templating engine - it seems more like a HTML generator. It's a pretty complex hammer to drive a carpet tack. Programmatically constructing DOM from that low of a level is still more trouble than it's worth.
For me, I stick to small chunks I can loop on my own if need be and use a simple tokenizer I wrote (see bpmv.toke() at https://github.com/BrynM/bpmv/blob/master/bpmv.js ). Far simpler and I can have anyone whip up HTML boilerplate to use.
I saw it used in a project once and it was a disaster. The problem being, by using javascript to represent html you are making your templates harder to write and harder to maintain.
This solution certainly has some cool features, but I strongly disagree with comparisons to haml. Where haml strips away a bunch of html syntactical weight, newt.js piles it on.
Sorry if i'm being too strong, but I just wanted to share my thoughts/experiences/criticism. It is clear the author has put a lot of work into this, including tests.
I like http://www.handlebarsjs.com/ for my javascript templating because I can literally cut and paste in some html into a template, add some logic(if/then blocks) and I'm done.