Skip to content

Instantly share code, notes, and snippets.

@rhettc
Created December 18, 2013 17:40
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 rhettc/8026577 to your computer and use it in GitHub Desktop.
Save rhettc/8026577 to your computer and use it in GitHub Desktop.
Yay - with blocks
When you're dealing with nested properties, a with block can define a context so that you don't have to write out the full dotted path.
The example below shows that inside the block we can directly access the properties of the book like title without typing book.title.
This is one of my favorite bits of syntactic sugar from VB.NET, glad to see it here.
{{#with book}}
<div class=”book”>
<h1>{{title}}</h1>
{{author}}<br />
{{text}}</p>
</div>
{{/with}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment