开发者

Node.js JADE linebreaks in source?

I wonder, why i don't see any linebreaks in my sourcecode if i parse my jade template. It looks like this:

!!! 5
html
head
    title= title
    link(rel='stylesheet', href='/stylesheets/css.css')
    link(rel='stylesheet', href='/stylesheets/blitzer/jquery-ui-1.8.10.custom.css')
    link(rel='stylesheet', href='/stylesheets/table_jui.css')

    script(type="text/javascript", src="/javascripts/jquery.min.js")
    script(type="text/javascript", src="/javascripts/jquery-ui.min.js")
    script(type="text/javascript", src="/javascripts/jquery.jwNotify.js")
    script(type="text/javascript", src="/javascripts/jquery.dataTables.min.js")
    script(type="text/javascript", src="/javascripts/js.js")

body!= body

Now my sourcecode looks like this:

<!DOCTYPE html><html><head><title>Express v2</title><link rel="stylesheet" href="/stylesheets/css.css"><link rel="stylesheet" href="/stylesheets/blitzer/jquery-ui-1.8.10.custom.css"><link rel="stylesheet" href="/styles开发者_如何转开发heets/table_jui.css"><script type="text/javascript" src="/javascripts/jquery.min.js"></script><script type="text/javascript" src="/javascripts/jquery-ui.min.js"></script><script type="text/javascript" src="/javascripts/jquery.jwNotify.js"></script><script type="text/javascript" src="/javascripts/jquery.dataTables.min.js"></script><script type="text/javascript" src="/javascripts/js.js"></script></head><body></body></html>

Would be fine to see line breaks in sourcecode to debug or not? Anyone has an ideo, how i can manage this? Thx for info!


Sometimes, you want to see pretty html output. To un-uglify your Jade output, pass the pretty option to the compiler in your app.js:

app.set('view options', { pretty: true });


Because Jade doesn't compile any line breaks into your html source by default.

It's just sending unneccesary bytes to the client slowing download speed and increasing bandwidth consumption.

Similar Question: Express and pretty HTML

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜