kirbysayshi / vash

Vash, the 60 billion double-dollar template-maker. Razor syntax, for JavaScript templates
Other
522 stars 60 forks source link

json object inside variables? #99

Closed fghhfg closed 8 years ago

fghhfg commented 8 years ago

Can it do this? I tried, but failed.

// model = 
{
  what: 'hello!',
  title: 'sdfsdd',
  menu: {
    one: 'about',
    two: 'company'
  }  
}
<div>@model.menu.one</div> <!-- Is this work? -->
<div>@model.menu.two</div> <!-- Is this work? -->

otherwise I have too many variable in same scope.

fghhfg commented 8 years ago

I see...

JSON.parse(fs.readFileSync('src/component/menu.json', 'utf8'))