Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pug/Jade template engine: html beautifier?

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.

like image 407
alice Avatar asked Feb 14 '11 06:02

alice


People also ask

How do I convert HTML to pug?

Click on the URL button, Enter URL and Submit. This tool supports loading the HTML File to transform to PUG. Click on the Upload button and select File. HTML to PUG Converter Online works well on Windows, MAC, Linux, Chrome, Firefox, Edge, and Safari.

How do you compile a pug?

The general rendering process of Pug is simple. pug. compile() will compile the Pug source code into a JavaScript function that takes a data object (called “ locals ”) as an argument. Call that resultant function with your data, and voilà!, it will return a string of HTML rendered with your data.


1 Answers

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

app.set('view options', { pretty: true });
like image 54
Jonathan Julian Avatar answered Sep 21 '22 23:09

Jonathan Julian