D
D
Dmitry2018-02-10 20:12:16
HTML
Dmitry, 2018-02-10 20:12:16

How to format pug output?

Good time to all. I know the topic was on the toaster. But maybe there is already a solution. How to format the code can be on the output from PUG. So it is formatted, but inline elements all go to the line, for example, such as links, everything goes to the line. They asked me to make up but that HTML was beautiful and understandable. I've been thinking about this topic.
https://www.npmjs.com/package/gulp-html-beautify there is such a plugin but it's not clear how it is with the settings. Can anyone figure out how to set it up. Yes, and who with English is better, I didn’t really understand something until the settings.
Then there is such an article 4webfan.ru/pug-gulp here you can really just make block elements out of inline elements on the output .. So-so solution, but at least something)
here, in general, someone can help

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2018-02-10
@kaktys123

https://github.com/jonschlinkert/gulp-prettify/blo...
I also found a plugin. You can also configure exceptions how to handle tags.
And it looks like those are all options. And in fact, what else can you think of here.
But this one and 4webfan.ru/pug-gulp this work already better, you can get the output code

A
Andrey Tsvetkov, 2018-02-10
@yellow79

It is necessary to set the parameter pretty=true when compiling in options if you are rendering via Express, then it is enough to call this app.locals.pretty = true; if not via express, then something like this pug.compileFile('template.pug', {pretty:true})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question