2
votes

NOTE: Similar to this question, but not the same.

I have an expressjs node website (WIP), but I keep getting the follwoing error:

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

My src\dynamic\views\index.jade:

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

The _includes/navbars/topNav.jade file is just a basic jade file depicting a simple bootstrap navbar, so I will omit it.

_includes/head/head:

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

   body
      block body

Now when I visit localhost:3000, I am greeted with my compiled jade file, except the <head> element is empty, so there are no css links! Checking the console log I see the previously mentioned error/warning.

What am I doing wrong?

1
I think that you should only use extends once in your view. Use include for topNav - Molda
Thanks. Didn't know there was an include statement. - Kaiden Prince

1 Answers

0
votes

Many thanks to @Molda for pointing me in the right direction. (S)he said:

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

So as soon as I replaced that one extends it worked, and my <head> element was no longer empty.

Now I cannot find anything that documents the "you can only use extends once" rule, but as far as I can gather only the last extends is used.