gruntjs/grunt-contrib-handlebars

Partial's context is undefined

Opened this issue · 0 comments

My partiial _navbar.hbs:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Dawn</title>
</head>
<body>

  <h1>Hello</h1>

  <nav>
    <ul>
      {{#each navbarItems}}
      <li>
        <a href="{{link}}">{{title}}</a>
      </li>
      {{/each}}
    </ul>
  </nav>

My page index.hbs:

{{> navbar }}

<div class="page-index">
  <h4>Home, {{name}}</h4>
</div>

I custome task in Gruntfile.coffee:

// require handlebars
Handlebars = require './vendor/handlebars/handlebars'

// custome task
templates = (require "./.tmp/jst/template")(Handlebars)
html = templates['index']({
  name: 'juo'
  navbarItems: navbarItems
})

Then i log the html, there is no li element in nav > ul