# gulp-webp-for-html

> replace with for WebP

Latest version **1.0.4** (published 2021-08-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-webp-for-html
pnpm add gulp-webp-for-html
yarn add gulp-webp-for-html
bun add gulp-webp-for-html
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2021-08-09 |
| First published | 2021-08-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alexey Morozov |
| Maintainers | cheg |
| Keywords | webp, html, picture, gulp, gulp-webp-html, gulp-webp-for-html |

## Links

- npm: https://www.npmjs.com/package/gulp-webp-for-html
- Homepage: https://github.com/thecheg/gulp-webp-for-html
- npm.io page: https://npm.io/package/gulp-webp-for-html

## Dependencies (3)

- [through2](https://npm.io/package/through2.md) ^4.0.2
- [gulp-util](https://npm.io/package/gulp-util.md) ^3.0.7
- [plugin-error](https://npm.io/package/plugin-error.md) ^1.0.0

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2021-08-09
- 1.0.3 — 2021-08-05
- 1.0.2 — 2021-08-03
- 1.0.1 — 2021-08-03
- 1.0.0 — 2021-08-03

## README

# gulp-webp-for-html
Replaces `<img />` with `<picture />` for WebP
## Example
```html
// Input
<img src="/images/image.jpg">

// Output
<picture>
	<source srcset="/images/image.webp" type="image/webp">
	<source srcset="/images/image.jpg" type="image/jpeg">
	<img src="/images/image.jpg">
</picture>
```
### Supported extensions
- `.jpg`, `.jpeg`, `.JPG`, `.JPEG`
- `.png`, `.PNG`
- `.svg`, `.SVG`
- `.gif`, `.GIF`
- `.avif`, `.AVIF`
- `.tif`, `.tiff`, `.TIF`, `.TIFF`
- `.ico`, `.ICO`
## Install
```bash
npm i gulp-webp-for-html --save-dev
```
## Usage
```javascript
var webphtml = require('gulp-webp-for-html');
gulp.task('html',function(){
	gulp.src('./assets/**/*.html')
		.pipe(webphtml())
		.pipe(gulp.dest('./public/'))
});
```
### Options
Pass extensions array as argument to specify files for WebP supporting:
```javascript
var webphtml = require('gulp-webp-for-html');
gulp.task('html',function(){
	gulp.src('./assets/**/*.html')
		.pipe(webphtml(
			['.jpg', '.png', '.gif']
		))
		.pipe(gulp.dest('./public/'))
});
```

---
_Source: https://npm.io/package/gulp-webp-for-html · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
