Whenever I render a JADE template, I get all HTML in a single line. This makes it difficult to read in view-source mode. How can I tell JADE to create HTML which is properly indented?
Here is my template:
#application
p#docs
a(href='/docs/index.html') Documentation
p#user-input
input#msg(name='msg', size='50')
input#submit(name='submit', type='submit', value='Send a Message')
ul#messages
In Jade’s compiling options set
prettyto true.Which can be done in multiple ways depending of how you are compiling them
-Por--prettyflag.app.locals.pretty = true;(express 2.x used a different syntax:
app.set('view options', { pretty: true });, see migration guide: https://github.com/visionmedia/express/wiki/Migrating-from-2.x-to-3.x)Then you can do the following
which will produce