Skip to content

This is a modified version of the plugin gulp-webp-html-nosvg. Here was fixed thebug that added two dots before webp to the final html file. No SVG format. The mode is possible only for relative links.

License

Notifications You must be signed in to change notification settings

GreyAdmiral/gulp-webp-html-nosvg-local

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gulp-webp-html-nosvg-local

This is a modified version of the plugin gulp-webp-html-nosvg. Here was fixed thebug that added two dots before webp to the final html file. No SVG format. The mode is possible only for relative links.

Example

// Input
<img src="/images/catalogImage.jpg">

// Output
<picture>
    <source srcset="/images/catalogImage.webp" type="image/webp">
    <img src="/images/catalogImage.jpg">
</picture>


// Input
<img src="/images/catalogImage.jpg" srcset="/images/catalogImage2x.jpg 2x">

// Output
<picture>
    <source srcset="/images/catalogImage.webp, /images/catalogImage2x.webp 2x" type="image/webp">
    <img src="/images/catalogImage.jpg" srcset="/images/catalogImage2x.jpg 2x">
</picture>

// Input
<img src="/images/catalogImage.jpg">
<img src="https://site.net/images/catalogImage.jpg">

// Output
<picture>
    <source srcset="/images/catalogImage.webp" type="image/webp">
    <img src="/images/catalogImage.jpg">
</picture>
<img src="https://site.net/images/catalogImage.jpg">

// Input
<img src="/images/catalogImage.svg">

// Output
<img src="/images/catalogImage.svg">

Install

npm i --save-dev gulp-webp-html-nosvg-local

Usage

let webphtml = require('gulp-webp-html-nosvg-local');

gulp.task('html',function(){
    gulp.src('./assets/**/*.html')
        .pipe(webphtml())
        .pipe(gulp.dest('./public/'))
});

or

gulp.task('html',function(){
    gulp.src('./assets/**/*.html')
        .pipe(webphtml(true))
        .pipe(gulp.dest('./public/'))
});

About

This is a modified version of the plugin gulp-webp-html-nosvg. Here was fixed thebug that added two dots before webp to the final html file. No SVG format. The mode is possible only for relative links.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published