News for hackers. Stuff that matters.
Re:Emblem.js: concise, indented alternative templating langu... by spullara on Tuesday February 19, 2013 @04:05PM (#5247039)
Why do people do this? Obfuscating the HTML seems like the worst of both worlds. Either use a component model that abstracts it away or use HTML so you can see what is going on. Also, get your code out of the view. Has the world gone mad?
Re:Emblem.js: concise, indented alternative templating langu... by machty on Tuesday February 19, 2013 @04:16PM (#5247089)
What code? The only stuff in there is to respond to changes in underlying data or pass click events to their rightful handler. Also, making something prettier, more readable, and easier to maintain seems like the opposite of obfuscatory, no?
Re:Emblem.js: concise, indented alternative templating langu... by spullara on Tuesday February 19, 2013 @04:40PM (#5247235)
This is code "each person in people" — once you go down the path of doing that kind of thing, the next thing people will ask for are filters, etc. and eventually half your business logic is in the "template" and half in the view code.
Re:Emblem.js: concise, indented alternative templating langu... by digitaltoad on Tuesday February 19, 2013 @05:25PM (#5247505)
I would say that "each person in people" is a far cry from the type of logic in views normally frowned upon. What would you propose to be different in this case? Where does iteration of this type belong?
Re:Emblem.js: concise, indented alternative templating langu... by spullara on Tuesday February 19, 2013 @05:36PM (#5247565)
Check out mustache. It has things that can be used for iteration but it isn't explicit and you decide what actually happens at runtime in code rather than in the template.

http://mustache.github.com

Re:Emblem.js: concise, indented alternative templating langu... by machty on Tuesday February 19, 2013 @06:04PM (#5247736)
The {{#array}}item{{/array}} syntax is functionally equivalent to and equally logicless as {{#each array}}item{{/each}}, only the latter (handlebars) has the benefit of being precompilable and easily extensible by frameworks such as Ember, Meteor, and the like.
Re:Emblem.js: concise, indented alternative templating langu... by spullara on Tuesday February 19, 2013 @11:32PM (#5248971)
They may be equivalent, however, the first version has the freedom to do what they wish, for example, what is represented by array may not be directly iterable or it may be filtered. Precompilation is available in a variety of languages for mustache, including js.

IMOH, handlebars is a lazy version of mustache where the developer using it sacrifices maintainability and encapsulation. Which is probably ok for most apps that don't grow beyond a single developer.

Re:Emblem.js: concise, indented alternative templating langu... by Gigablah on Tuesday February 19, 2013 @07:54PM (#5248260)
Hogan.js by Twitter is a mustache implementation that supports precompilation, among other things.
Re:Emblem.js: concise, indented alternative templating langu... by njharman on Tuesday February 19, 2013 @04:10PM (#5247058)
I'm guessing cause they use sucky editors that make writing *ML style markup hard.
Re:Emblem.js: concise, indented alternative templating langu... by jacquesc on Tuesday February 19, 2013 @04:23PM (#5247126)
Writing is the easy part (stuff like zencoding tools help with this).

But reading and grokking mountains of HTML code gets difficult for some people (me). That's when these templating languages are a lifesaver.

Re:Emblem.js: concise, indented alternative templating langu... by zachrose on Tuesday February 19, 2013 @04:21PM (#5247116)
Well yes, but Haml/Emblem are trying to answer the question of where tooling should belong. Is it better to "abstract" syntax with your development environment, or in the source code itself?