I am using Jade in Express.js and I noticed that the html output is all in one line. On the Jade website ( http://scalate.fusesource.org/documentation/jade-syntax.html ) it says that formatted output is standard and that the options are ScamlOptions.nl and ScamlOptions.indent, but I can't find those options anywhere to see if they are set incorrectly. Does anyone know where I can find those options or is there another way to force clean formatting?
Thanks!
This thread didn't help: How to output pretty html in Express?
In Express 3, the api has changed for (at least) this view option.
I set app.locals.pretty
and it seems to be working just fine. I call it within my app.js
(or server.js
) right after I set the view engine in app.configure()
app.use(function(req, res, next) {
app.locals.pretty = true;
next();
});
Also, Jade is not designed to create human-readable output. All the indention and new lines are just wasting space and are not important for any browser to process you HTML. But you could try:
app.set('view options', { pretty: true });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With