gpt4 book ai didi

node.js - Jade 意外 block 错误

转载 作者:太空宇宙 更新时间:2023-11-03 22:33:43 24 4
gpt4 key购买 nike

注意:类似于 this问题,但不一样。

我有一个expressjs Node 网站(WIP),但我不断收到以下错误:

Warning: Unexpected block "head"  on line 3 of \src\dynamic\views\index.jade. This block is never used. This warning will be an error in v2.0.0Warning: Unexpected block "body"  on line 5 of \src\dynamic\views\index.jade. This block is never used. This warning will be an error in v2.0.0

我的src\dynamic\views\index.jade :

extends _includes/head/headblock head   title Skool - On Our Way!block body   extends _includes/navbars/topNav

_includes/navbars/topNav.jade file只是一个基本的jade文件,描述了一个简单的引导导航栏,所以我将省略它。

_includes/head/head :

doctype htmlhtml   head      link(rel="styleSheet" href="css/main.css")      script(src="js/app.js")      block head   body      block body

现在当我访问localhost:3000时,我收到了我编译的jade文件,除了<head>元素为空,因此没有 css 链接!检查控制台日志,我看到前面提到的错误/警告。

我做错了什么?

最佳答案

非常感谢@Molda为我指明了正确的方向。 (S)他说:

I think that you should only use extends once in your view. Use include for topNav.

所以,一旦我更换了那个扩展,它就起作用了,我的 <head>元素不再为空。

现在我找不到任何记录“您只能使用 extends 一次”规则的内容,但据我所知,仅使用了最后一个扩展。

关于node.js - Jade 意外 block 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33130419/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com