A
A
Andrey Zyryanov2021-03-28 15:16:53
HTML
Andrey Zyryanov, 2021-03-28 15:16:53

Why is gulp-webp-html not working?

For some reason, the gulp-webp-html plugin doesn't want to work.

There is html code:

<section class="map">
  <h2 class="visually-hidden">Схема проезда</h2>
  <figure class="map__wrapper">
    <div class="map__interactive" id="map-interactive">
      <p>Нажмите, чтобы включить интерактивную карту</p>
    </div>
    <picture>
      <source media="(min-width: 960px)" srcset="img/map.png">
      <source media="(min-width: 660px)" srcset="img/map-tablet.png">
      <img src="img/map-mobile.png" alt="Схема проезда в наш офис" class="map__image">
    </picture>
  </figure>
</section>


I connect the plugin and add it to the task:
const webpHTML = require("gulp-webp-html");

function html() {
    return src(path.src.html)
        .pipe(fileInclude())
        .pipe(webpHTML())
        .pipe(dest(path.build.html))
        .pipe(server.stream());
}

exports.html = html;


The output is the same code, without webp. Tell me what I'm doing wrong?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
NFI, 2021-03-28
@NFI

In the dock, they initially connect just a picture with just an img tag. And the galp itself wraps it in a picture. Well, according to the doc https://www.npmjs.com/package/gulp-webp-html . I would also include gulp-webp to convert images to the desired format

L
Leonid Yakovlev, 2021-03-28
@deleo547

Need more information.
Action script, preferably all gulpfile code

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question