admin管理员组文章数量:1287859
I'm referring the following great tutorial on MEAN stack.
Now I'm facing a template(JADE) related issue which I'm not able to resolve :( Can you plz have a look and help me if possible.
/
doctype 5
html(lang='en')
head
meta(charset='utf-8')
meta(name='viewport', content='width=device-width,
initial-scale=1, user-scalable=no')
title= title
link(rel='stylesheet', href='//netdna.bootstrapcdn/bootstrap/3.0.1/
css/bootstrap.min.css')
link(rel='stylesheet', href='/stylesheets/style.css')
body
nav.navbar.navbar-inverse.navbar-fixed-top(role='navigation')
div.navbar-header
a.navbar-brand(href='#/polls')= title
div.container
div
I'm getting this exception. Tried couple of varitions but couldn't resolve it yet.
Error: C:\DevEnv\UT3_Node\HelloWorldNodeProject\views\index.jade:14
12| a.navbar-brand(href='#/polls')= title
13| div.container
> 14| div
**link is self closing and should not have content.**
Thanks in adv.
I'm referring the following great tutorial on MEAN stack.
Now I'm facing a template(JADE) related issue which I'm not able to resolve :( Can you plz have a look and help me if possible.
http://www.ibm./developerworks/library/wa-nodejs-polling-app/
doctype 5
html(lang='en')
head
meta(charset='utf-8')
meta(name='viewport', content='width=device-width,
initial-scale=1, user-scalable=no')
title= title
link(rel='stylesheet', href='//netdna.bootstrapcdn./bootstrap/3.0.1/
css/bootstrap.min.css')
link(rel='stylesheet', href='/stylesheets/style.css')
body
nav.navbar.navbar-inverse.navbar-fixed-top(role='navigation')
div.navbar-header
a.navbar-brand(href='#/polls')= title
div.container
div
I'm getting this exception. Tried couple of varitions but couldn't resolve it yet.
Error: C:\DevEnv\UT3_Node\HelloWorldNodeProject\views\index.jade:14
12| a.navbar-brand(href='#/polls')= title
13| div.container
> 14| div
**link is self closing and should not have content.**
Thanks in adv.
Share Improve this question asked Dec 28, 2013 at 18:30 user19user19 552 silver badges7 bronze badges 1-
a.navbar-brand(href='#/polls')= title
remove space beforetitle
– vittore Commented Dec 28, 2013 at 18:33
3 Answers
Reset to default 8Your problem is this line:
link(rel='stylesheet', href='/stylesheets/style.css')
You can't see it very well on StackOverflow, but you have a bunch of whitespace after the tag.
The whitespace is shown here replaced with _
:
link(rel='stylesheet', href='/stylesheets/style.css')________________
So your Jade would generate something like:
<link rel="stylesheet" href="/stylesheets/style.css">________________</link>
which is not allowed, since <link>
elements are not allowed to have child nodes.
a.navbar-brand(href='#/polls')= title
remove space before title
a.navbar-brand(href='#/polls')=title
I had the same issue with one of the examples in the Practical Node.js text. The root cause was my error - using double quotes in a link definition instead of single quotes. The challenge was that the message (link is self closing and should not have content.) was appearing on a div statement and hence was very confusing. It turns out that the error was in my include file rather than where jade indicated. The line number was correct, but it was showing the wrong file content. Once I had that figured out, the fix was easy.
Seems to be a bug in the JADE piler.
本文标签: javascriptnodejsjadelink is self closing and should not have contentStack Overflow
版权声明:本文标题:javascript - node.js + jade - link is self closing and should not have content - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741329831a2372703.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论