Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xvoland/gulp-xv-webp-html

GULP extension for support tag <picture> WEBP images and replaced original image tag in HTML in other words: replace <img> to <picture> for supports webp
https://github.com/xvoland/gulp-xv-webp-html

avif gulp gulp-plugin gulp-tasks gulp-webp gulp-webp-html gulp-xv gulpjs html jpg nodejs npm-module npm-package picture plugins svg tag-image tag-picture webp webp-fix

Last synced: about 1 month ago
JSON representation

GULP extension for support tag <picture> WEBP images and replaced original image tag in HTML in other words: replace <img> to <picture> for supports webp

Awesome Lists containing this project

README

        

# gulp-xv-webp-html.js
GULP extension for support WEBP images and replace original image tag in HTML

in other words: replace `` to `` for supports webp

**Support file extensions:** `.jpg, .png, .gif, .jpeg, .avif, .svg, .tiff`

[NPM package home page][npm]

**This NodeJS package is a nice addition to my [HTML-template](https://github.com/xvoland/gulp-xv-HTML-Template) with live update and support SCSS.**

*P.S.: I wrote this npm-package because others similar had errors and sometimes didn't work correctly with the input data.*

## Output Example

#### Example #1
```html
// Input

```

```html
// Output



```

#### Example #2
```html
// Input

```

```html
// Output



```

Also, more practical of use you can find in my other project [Gulp-xv-HTML-Template](https://github.com/xvoland/gulp-xv-HTML-Template)

## Install

```bash
npm i --save-dev gulp-xv-webp-html
```

## Usage

Given a `package.json` file that has some dependencies within:

```json
{
"dependencies": {
"plugin-error": "^1.0.0",
"through2": "^4.0.2"
}
}
```

Adding this into your `Gulpfile.js`:
```javascript
const gulp = require('gulp')
const webpHTML = require("gulp-xv-webp-html")
```

#### Example #1

```javascript
var webpHTML = require('gulp-xv-webp-html');

function html() {
return src('./source/*.html')
.pipe(webpHTML())
.pipe(gulp.dest('./destHTML/'))
});

exports.html = html;
```

#### Example #2
```javascript
var webpHTML = require('gulp-xv-webp-html');

gulp.task("webpHTML", function(){
return gulp.src(['./sourceHTML/**/*.html'])
.pipe(webpHTML())
.pipe(gulp.dest('./destHTML/'))})
```

#### Example #3
```javascript
var webpHTML = require('gulp-xv-webp-html');

gulp.task("webpHTML", function(){
return gulp.src(['./sourceHTML/**/*.html'])
.pipe(webpHTML(['.jpg', '.svg']))
.pipe(gulp.dest('./destHTML/'))})
```

## Visualization of npm dependency

![Default view](https://github.com/xvoland/gulp-xv-webp-html/raw/main/images/gulp-xv-webp-html.png)

Follow link for live view: [View live 2D map](https://npm.anvaka.com/#/view/2d/gulp-xv-webp-html)

## Liked it?
Hope you liked this project, don't forget to give it a star ⭐.

## Donation & Sponsors

I’ll continue to work and improve the script features regardless of the outcome of funding, because it's rewarding to see that people are using it and it does the job for them. Still I would appreciate your support in covering some of the expenses with the domain hosting and programming hours which are taken from my family time.

[Donate any amount for my projects][paypal]

Click here to lend your support to Extractor and make a donation!
---
![GitHub stats](https://github-readme-stats.vercel.app/api?username=xvoland&show_icons=true&theme=radical&hide_border=true)

## Other

📺 Latest my YouTube Videos

- [🔥 Lifehack Of Open a Sealed Tube. Did You Know?](https://www.youtube.com/watch?v=YlD9b6KnfdM)
- [💰 UAH 10 coins 2024 Ukraine’s New Medical Forces Coin. What is the price of the coin?](https://www.youtube.com/watch?v=qdtfhG7LqXg)
- [AI Avatar Demo](https://www.youtube.com/watch?v=EJhAssYHNNI)
- [ iPhone More Protection Against Theft iOS18 Stolen Device Protection](https://www.youtube.com/watch?v=I4pHVACAEYs)
- [NO LUT. Vintage Nikon D3100 DSLR as movie cam. Test Cinematic Look](https://www.youtube.com/watch?v=KQkXScIb0rk)

➡️ [more videos...][youtube]

## License

Author [Vitalii Tereshchuk][home]. © 2021, MIT license.
Or welcome to my [YouTube channel][youtube]

[home]: http://dotoca.net
[npm]: https://www.npmjs.com/package/gulp-xv-webp-html
[paypal]: https://paypal.me/xvoland
[youtube]: https://youtube.com/xvoland
[instagram]: https://www.instagram.com/xvoland/
[hosting]: https://goo.gl/3KpxQI
[opencollective]: https://opencollective.com/extract/backers/0/website