Error set attribute
est-by opened this issue · comments
- $pref_url="public/client/"
html(lang='en')
head
block head
//ERROR
script(src="#{$pref_url}node_modules/systemjs/dist/system.src.js")
//OK
script(src=$pref_url."node_modules/systemjs/dist/system.src.js")
Could you give some more explanation and also format your example so that I can see the actual problem?
Both compile correctly for me
http://sandbox.jade.talesoft.io/id-5730955f76d8f.html
Alright, what you're running into is a simple escaping-problem.
Jade escapes everything by default. It doesn't help using !{$pref_url}
, because the attribute value is an expression and gets escaped separately from the interpolation.
If you want it unescaped, use the following
link(rel="stylesheet", href!="#{$url_root}app.css")
That works (I tested it here)
Notice the !=
to define the atttribute, which tells Jade: Don't escape this attribute.
Notice that this is wanted behaviour, since it protects your site from XSS-attacks from feeding user input into Jade files (automatically, by default).
Thank you! Everything is working! Thank you for the quick response.