Skip to content

Instantly share code, notes, and snippets.

@scottmessinger
Created June 6, 2011 19:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scottmessinger/1010893 to your computer and use it in GitHub Desktop.
Save scottmessinger/1010893 to your computer and use it in GitHub Desktop.
Handlebars in Sproutcore
Hi Tom and Yehuda,
I like html. I like handlebars. I don't like what Sproutcore does with handlebars. In the example below, it appears that Sproutcore modifies #each to automatically insert li tags. I find this aggravating. I want Sproutcore to handle my data, DOM updates, etc and let me worry about markup. By their nature, helper methods are not transparent and make it difficult for designers to mark up a page for a SC app.
I like using data-attr because they respect MY markup. I can get behind handlebars in SC if it can also respect my markup.
Thanks for dialoging about this. I really want to use SC...I just can't get over the view complexity at this point.
Thanks!
Scott
From: http://guides.sproutcore20.com/using_handlebars.html
{{#each people}}
Hello, {{name}}!
{{/each}}
This will print a list like this:
<ul>
<li>Hello, Steph!</li>
<li>Hello, Tom!</li>
</ul>
From: http://handlebars.strobeapp.com/
<ul class="people_list">
{{#each people}}
<li>{{this}}</li>
{{/each}}}}
</ul>
<ul class="people_list">
<li>Yehuda Katz</li>
<li>Alan Johnson</li>
<li>Charles Jolley</li>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment