2015-10-14 31 views
1

注意:类似于this的问题,但不一样。Jade意外的块错误

我有一个expressjs节点网站(WIP),但我不断收到follwoing错误:

 
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.0 
Warning: 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/head 
block head 
    title Skool - On Our Way! 
block body 
    extends _includes/navbars/topNav 

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

_includes/head/head

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

    body 
     block body 

现在,当我访问localhost:3000,我招呼着我的编译玉文件,除了<head>元素是空的,所以有没有CSS联系!检查控制台日志我看到前面提到的错误/警告。

我在做什么错?

+0

我认为你应该只在你的视图中使用** extends **。使用** include ** for topNav – Molda

+0

谢谢。不知道有一个包含声明。 –

回答

0

非常感谢@Molda指引我在正确的方向。因此,一旦

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

为我更换了一个扩展它的工作,我的<head>元素不再是空的:他(她)说。

现在我找不到任何证明文件“只能使用extends”的规则,但据我所能收集的只有最后一个使用的扩展名。