Git Product home page Git Product logo

kaku's Introduction

I do npm install and my colleagues think it's amazing.

kaku's People

Contributors

dependabot[bot] avatar greatwizard avatar milofultz avatar thomasorus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

milofultz

kaku's Issues

Add responsive images with srcset, different images format support, how to polyfill images?

Kaku image shortcut should do better:

  • Use the source html element to provided different types of images (webp, jpg)
  • Use the srcset attr to provide different image sizes
  • Use loading = lazy on the image tag
  • Each image should exist in 3 to 4 versions : 300, 600, 900 and maybe 1200 pixels.

The code when using a figcaption should look like this:

 <figure>
        <picture>
            <source type="image/webp" srcset="
                https://raw.githubusercontent.com/Thomasorus/Ronbun/master/dist/media/hhkb-400.webp 400w,
                https://raw.githubusercontent.com/Thomasorus/Ronbun/master/dist/media/hhkb-800.webp 800w,
                https://raw.githubusercontent.com/Thomasorus/Ronbun/master/dist/media/hhkb.webp
              "
              />
    
            <img srcset="
                https://raw.githubusercontent.com/Thomasorus/Ronbun/master/dist/media/hhkb-400.jpg 400w,
                https://raw.githubusercontent.com/Thomasorus/Ronbun/master/dist/media/hhkb-800.jpg 800w,
                https://raw.githubusercontent.com/Thomasorus/Ronbun/master/dist/media/hhkb.jpg
              " src="https://raw.githubusercontent.com/Thomasorus/Ronbun/master/dist/media/hhkb-400.jpg"
                alt="My keyboard script" loading="lazy" />
        </picture>
        <figcaption>This is my super figcaption text</figcaption>
    </figure>

Demo here

Kinda unsure about how to polyfill lazy loading. Most of the time it requires having src and srcset replaced by data-src and data-srcset in the html. If lazy loading works, a js script changes them back to src and srcset and native lazy load is automatic. If it's not supported, the script has to use intersection observer to change src and srcset on the fly when they arrive in the viewport.

But if both lazy loading and intersection observer fail, or the user disabled javascript, then img and source elements are left without valid src and srcsets, so no image appears. The only solution is then to use a noscript element and copy duplicate the img/source html with correct src and srcset. But that doubles the amount of html, the other img and source elements are still there which is bad from an accessibility standpoint, and so are their alt and figcaption tags which are creating duplicating with the ones in the noscript element.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.