Pug/Jade template engine: html beautifier?
Pregunta
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.
Solución
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
Otros consejos
In app.js, pass the pretty
option to the Jade compiler.
app.set('view options', { pretty: true });
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.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow