Closed OnkelTem closed 5 years ago
Indentation of Pug determines the nesting of elements, not the HTML indentation. Then Pug generates also PHP codes (mixins, includes, etc.) so you won't have consistent indentation across both PHP and HTML output. Minified HTML is faster to download so you should not need to add whitespaces in output.
You still can check the pretty option: https://phug-lang.com/#pretty-boolean-string
But I would rather recommend to check HTML formatting dedicated packages. But consider wisely if you really need to format your HTML output, It should be only rares cases, such as displaying a HTML code snippet in some <pre>
element.
I agree we don't need this pretty print for production. But my case is special -- I generate Anki decks and you see, its users get used to have access to card templates editing. So they won't be happy to see optimized HTML :)
OK so you may better use some third-library like: https://packagist.org/packages/mihaeu/html-formatter this way the final HTML is well indented no matter you use mixin, includes or any stuff.
I have the next template:
And the output is:
I cannot find the reason. Any ideas?