问题
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="/stylesheets/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!
回答1:
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 });
回答2:
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
来源:https://stackoverflow.com/questions/6504624/node-js-jade-linebreaks-in-source