queckezz/koa-views

how to render handlebars layout partials with koa-views

Robin-front opened this issue · 2 comments

I try to run this,
Handlebars.registerPartial('myPartial', '{{name}}')
but, it doesn't work

@Robin-front 问题解决了吗?I have the same question ...

const app = new Koa()
  .use(views(__dirname, {
    map: { hbs: 'handlebars' },
    options: {
      partials: {
        subTitle: './my-partial' // requires ./my-partial.hbs
      }
    }
  }))
  .use(function (ctx) {
    ctx.state = { title: 'my title', author: 'queckezz' }
    return ctx.render('./my-view.hbs')
  })