After compiling the following Pug (Jade) code in the output HTML-code, after the comments do not transfer to a new line:

// blade: Π—Π°ΠΌΠ΅Π½ΠΈ ссылку {{ route('route_pseudoname') }} a.header-language-option(href='') Русский // blade: Π—Π°ΠΌΠ΅Π½ΠΈ ссылку {{ route('route_pseudoname') }} a.header-language-option(href='') English <!-- blade: Π—Π°ΠΌΠ΅Π½ΠΈ ссылку {{ route('route_pseudoname') }}--><a href="" class="header-language-option">Русский</a> <!-- blade: Π—Π°ΠΌΠ΅Π½ΠΈ ссылку {{ route('route_pseudoname') }}--><a href="" class="header-language-option">English</a> 

Are there any regularities when a new line comes after a comment, or is it just a glitch?

( Online editor for experiments )

    1 answer 1

    By default, Pug minifies compiled HTML. To prevent this, you must specify pretty: true :

     gulp.task('views', function buildHTML() { return gulp.src('views/*.pug') .pipe(pug({ pretty: true; })) }); 

    I would also advise you to remove the comments from the compiled file and leave them only in Pug. This is done like this:

     //- blade: Π—Π°ΠΌΠ΅Π½ΠΈ ссылку {{ route('route_pseudoname') }} a.header-language-option(href='') Русский //- blade: Π—Π°ΠΌΠ΅Π½ΠΈ ссылку {{ route('route_pseudoname') }} a.header-language-option(href='') English