npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-xv-webp-html

v1.1.2

Published

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

Downloads

56

Readme

gulp-xv-webp-html.js

GULP extension for support WEBP images and replace original image tag in HTML

in other words: replace <img> to <picture> for supports webp

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

Package home page: https://www.npmjs.com/package/gulp-xv-webp-html

This NodeJS package is a nice addition to my 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

// Input
<img class="lazyload" src="/images/Image.jpg" width="100" height="100">
// Output
<picture>
    <source srcset="/images/Image.webp" type="image/webp">
    <source srcset="/images/Image.jpg" type="image/jpeg">
    <img class="lazyload" src="images/Image.jpg" width="100" height="100">
</picture>

Example #2

// Input
<img src="/images/Image.svg" width="100" height="100">
// Output
<picture>
    <source srcset="images/Image.webp" type="image/webp">
    <source srcset="images/Image.svg" type="image/svg+xml">
    <img src="images/Image.svg" width="100" height="100">
</picture>

Also, more practical of use you can find in my other project Gulp-xv-HTML-Template

Install

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

Usage

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

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

Adding this into your Gulpfile.js:

const gulp = require('gulp')
const webpHTML = require("gulp-xv-webp-html")

Example #1

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

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

exports.html = html;

Example #2

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

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

Example #3

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

Follow link for live view: View live 2D map

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 https://paypal.me/xvoland

License

Author Vitalii Tereshchuk. © 2021, MIT license. Or welcome to my YouTube channel