Skip to content
  • home
  • portfolio
  • web design journal
  • blog
    • adventure
    • san diego
    • projects
    • website design

handlebars

Reference a Variable Outside of a Handlebars Each Loop

November 17, 2016   |   Web Dev

Once within an Handlebars each loop, you can no longer just reference a variable that is outside the loop.  In the example below, the first ‘ParentVariable’ will render correctly, but the one within the “each” loop won’t.  {{ParentVariable}} {{#each Users}} {{ParentVariable}} {{/each}} To use the variable within the “each” block, you’ll need to add a […]

Read More

Using Handlebars Templates

December 24, 2015   |   Web Dev

 It generally takes me a few minutes to tease out the right code on the handlebars page to get everything to work, here is the essential code for setting up a handlebars template via javascript: Template Code (Html): Javascript Code: var data = {title: “Test Title”, body: “Test Body”}, source = $(“#test-template”).html(), template = Handlebars.compile(source), […]

Read More

Handlebars Just Adds Bloat and Complication

May 21, 2015   |   Web Dev

I kind of like Handlebars for templating, but more and more, I think it’s just makes the codebase more bloated and complicated: My problems with handlebars: 1. I can’t just use my existing javascript code. For instance, I have an existing function to format a phone number, but to use this within a handlebars template,  […]

Read More

Reference a Handlebars Template From Another Template (Nesting Templates)

May 19, 2015   |   Web Dev

Within the JS file, register a new partial (note: avoid underscores with with the name of the partial, or with the template names…this seems to cause issues): Handlebars.registerPartial(“inner-template”,$(“#tpl-inner-template”).html()); In the template template that you want to include the partial in, just reference the partial with: {{> inner-template Data }} If the data isn’t showing, try […]

Read More

HTML and Encoded Characters with Handlebars

September 14, 2013   |   Web Dev

As soon as I updated some of the templating on one of my websites to handlebars, HTML code wasn’t being rendered, and I recieved odd characters in the output, like:   My Blog Name » Blog Sub Title The solution to this is instead of using the standard double bracket to insert the content, use triple brackets […]

Read More
  • Adventure

    • adventure
    • gravelgrinding
    • hiking
    • running
  • The Built Environment

    • architecture
    • urbanity
  • Locations

    • san diego
    • portland
  • Freelance Life

    • freelancing
    • productivity
  • Web Dev

    • css
    • entrepreneurship
    • git
    • handlebars
    • html
    • inkscape
    • photoshop
    • php
    • sass
    • web design
    • web development
    • saphire

drempd | san diego, ca


home contact

adventures san diego urbanity and architecture projects stream website design

portfolio resume san diego web design freelance web designer

custom web design responsive web design website maintenance