Joker / jade

Jade.go - pug template engine for Go (golang)
BSD 3-Clause "New" or "Revised" License
354 stars 37 forks source link

How can i include other directory pug template? #32

Closed mouyong closed 4 years ago

mouyong commented 5 years ago

this is my dir tree.

image

main.go in iris

func (b *bootstrap) InitHtml() {
    tmpl := iris.Pug("./views", ".pug")

    tmpl.Reload(true)

    b.RegisterView(tmpl)
    b.HandleDir("/", "./public")
}

layouts/index.pug

doctype html
html
  head
    meta(charset="utf-8")
    block title
      title 任务管理系统
  body
    block content
    include views/partials/footer.pug

when i run build using GoLand. it's have some context error.

[ERRO] 2019/10/23 09:20 view: template:1: in 'Z:\code\go\task\views\layouts' subtemplate 'views/layouts/index.pug': parseSubFile() error: template:9: open footer.pug: The system cannot find the file specified.  work dir: Z:\code\go\task\views\layouts 

Process finished with exit code 0
Joker commented 4 years ago

I have never used the Iris framework and I don't know how it resolves paths. maybe include ../partials/footer.pug