K
K
Kote2017-07-05 22:53:45
HTML
Kote, 2017-07-05 22:53:45

How to compile selfclosed tags to PUG?

Good day,
there are: PUG files
I collect the output using gulp , the gulp-pug plugin
Task (it is hardly needed, but still) looks like this:

gulp.task('pug:build', function() {
  return gulp.src(path.src.pug)
      .pipe(pug())
      .pipe(gulp.dest(path.build.html))
      .pipe(reload({stream: true}));
});

For certain reasons, sometimes selfclosed tags are required, for example
<meta />
<input />
<img />

And pug always generates these tags strictly in the form:
<meta>
<input>
<img>

Google suggests that the arrangement of self-closed tags depends on the declared doctype (they say, put NOT html5 and it will be ok), however, this is not the case, I tried for example:
doctype basic
And other " old " doctypes - PUG stubbornly does NOT close the above tags .
I dug into the documentation , it says in black and white:
For example, whether self-closing tags end with /> or > depends on whether HTML or XML is specified.

I tried to prescribe already from hopelessness:
<?xml version="1.0" encoding="utf-8" ?>
The result is zero, the tag is NOT closed (

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kote, 2017-07-06
@kotemedia

distorted the markup by a third-party gulp-inline plugin

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question