Skip to content

Instantly share code, notes, and snippets.

@variousauthors
Created October 10, 2013 14:59
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 variousauthors/6919826 to your computer and use it in GitHub Desktop.
Save variousauthors/6919826 to your computer and use it in GitHub Desktop.
An example of Handlebars.
{{!-- a handlebars template might look like this --}}
<div class="{{#if myLibrary}}active{{/if}} library">
{{#each books}}
<div class="book">
<h3 class="title">{{ title }}</h3>
<span class="author">by {{ author }}</span>
{{#if isAvailable }}
<span class="availability">Available!</span>
{{else}}
<small class="availability">available soon</small>
{{/if}}
</div>
{{/each}}
</div>
{{!-- it won't look like this --}}
{{#if copies < 1 }}
<span class="availability">Available!</span>
{{else}}
<small class="availability">available soon</small>
{{/if}}
{{!-- that's why we say "handlebars is logicless" --}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment