7

I'm using jade/pug template engine with ExpressJS on Node.js. It outputs a html with single line. No indentation at all. I couldn't find any beautifier option.

Bharathvaj Ganesan
  • 3,054
  • 1
  • 18
  • 32
alice
  • 2,547
  • 4
  • 24
  • 30
  • possible duplicate of [ExpressJS: how to output pretty html](http://stackoverflow.com/questions/5276892/expressjs-how-to-output-pretty-html) – bummi Sep 13 '14 at 08:11

3 Answers3

6

In app.js, pass the pretty option to the Jade compiler.

app.set('view options', { pretty: true });
Jonathan Julian
  • 12,163
  • 2
  • 42
  • 48
4

There used to be a {pretty: true} option but it was removed because it messed up with whitespaces.

Refs:

https://github.com/visionmedia/jade/issues/#issue/91 https://github.com/visionmedia/jade/issues/closed/#issue/89

Carlosedp
  • 1,951
  • 1
  • 17
  • 15
1

If you are compileing from console, then you can use this :

jade views/ --out html --pretty layout.jade

it will generate beutyfied code in html folder.

johannesMatevosyan
  • 1,974
  • 2
  • 30
  • 40