user1692342
user1692342

Reputation: 5237

Warning: Unexpected block "scripts" Jade

I wrote a jade file as shown below:

extends layout

block content
  h1= title
  p Welcome 123 to #{title}

block scripts
  script(src='/socket.io/socket.io.js')
  script(src='/javascripts/client.js')

However when I run I get the following Warning: Warning: Unexpected block "scripts" This block is never used. This warning will be an error in v2.0.0

My Package.json file has jade version ~1.9.0

However this works when Jade version is ~1.8.2

What could be the problem?

Upvotes: 1

Views: 2694

Answers (2)

grapiuna
grapiuna

Reputation: 50

I was having the same error and was a typo with the spaces mixed with tabs. Try to remove all the spaces and add again. It worked with me: block conten*th*1= titlep Welcome 123 to #{title} Press enter between the th, ep and then add spaces to indent. I hope that helps.

Upvotes: 0

Rafik Harzi
Rafik Harzi

Reputation: 33

You should add the line: block scripts to your layout.jade file.

Upvotes: 3

Related Questions