【问题标题】:I am extending a pug layout(parent) to another pug layout(child).I am getting an error 'unexpected token:indent' from the parent layout我正在将哈巴狗布局(父)扩展到另一个哈巴狗布局(子)。我从父布局中收到错误“意外标记:缩进”
【发布时间】:2018-02-12 17:44:54
【问题描述】:

这个文件名是 layout.pug(parent):

 doctype html 
 html
   head
     title knowledgebase
   body 
     block content     
     br
     hr
     footer
       p Copyright © 2018

而这个文件名是 index.pug(child):

extends layout
block content
  h1 articles
  h1 #{title}

【问题讨论】:

    标签: node.js mongodb pug


    【解决方案1】:

    起初我认为你的代码一切都很好,然后我仔细查看了这里粘贴的内容。

    如果检查 layout.pug 中的代码,您会发现每一行都有一个前导空格。确保doctype htmlhtml(它们是父模板中的根元素)在行首有零个空格。

    否则您的代码看起来不错,应该可以按预期工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-09-25
      • 2018-05-17
      • 2022-08-14
      • 2018-01-02
      • 2017-07-13
      • 1970-01-01
      • 1970-01-01
      • 2018-10-20
      相关资源
      最近更新 更多