Warning: Unexpected block “scripts” Jade

谁说我不能喝 提交于 2019-12-11 09:57:40

问题


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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/27975302/warning-unexpected-block-scripts-jade

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!