Giter Club home page Giter Club logo

daltons's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar fossabot avatar julienpradet avatar kodiakhq[bot] avatar nhoizey avatar ryuran avatar welcomattic 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

daltons's Issues

Rename to something shorter, more explicit or fun/memorable

There are only two hard things in Computer Science: cache invalidation and naming things. — Phil Karlton

True.

responsive-image-widths is not easy to spell (image or images? width or widths?) and type in a shell, so we would like to rename it to something shorter, and either more explicit or more fun/memorable.

Current options:
👍 srcset-sizer
😁 daltons (there is already a dalton package on npm, but there should be no ambiguity)
🎉 BRITS: Better Responsive Image Tools Selection
❤️ RIWAL: Responsive Image Widths et AL.

You can vote with reactions, and suggest other names in comments.

Find a way to manage sizes for pictures

Currently the documentation say to run a commande for each sources.
We could make the script return a sizes list to each sources of a picture element with media query detected when runing resize by puppeteer.

Viewport width accuracy

It looks like Google Analytics' own "Browser Size" dimension we dismiss here gives a smaller viewport width than our own computed value:

image

I guess it doesn't include the scrollbar width.

  • Do we have to use the same value, or keep our own?
  • How does it deal with overflowing scrollbars?

Default return

Hello,

There is no return without verbose or destFile option.
I think we should display a spinner during process and only print final return at end.

Basic users would only have result or error.

Make it possible to generate two sets of images widths, for low and high screen densities

Screen with >2dppx density require lower quality, more compressed, images:
https://observablehq.com/@eeeps/visual-acuity-and-device-pixel-ratio

It might be better having different images widths for high density screens (most being mobiles) and low density screens.

Serving lower quality images to high density screens requires using <picture> with a density media query:

<picture>
  <source
    media="(min-resolution: 2dppx), (-webkit-min-device-pixel-ratio: 2)"
    sizes="…"
    srcset="
      image-q10-720.jpg 720w,
      image-q10-1280.jpg 1280w,
      image-q10-1400.jpg 1400w">
  <img
    src="image-q80-320.jpg"
    sizes="…"
    srcset="
      image-q80-360.jpg 360w,
      image-q80-800.jpg 800w,
      image-q80-1024.jpg 1024w">
</picture>

The 2dppx threshold should be a parameter.

Rework the target widths computing algorithm

@welcoMattic after working on it a little more, I'm not sure I understand the intent of this part:

https://github.com/cleverage/daltons/blob/master/src/index.js#L116-L125

  result.centroids.forEach((centroid) => {
    const centroidWidth = centroid[0]
    closestRealWidths.push(
      [...perfectWidths.keys()].reduce((prev, curr) => {
        return Math.abs(prev - centroidWidth) > Math.abs(curr - centroidWidth)
          ? curr
          : prev
      }),
    )
  })

Could you explain why you don't use the centroids directly?

Add bin and main entry in package.json

bin to expose responsive-image-sizes.js as a binany to be run in cli without node command.
main to set responsive-image-sizes.js default importable js of the package to making it usable as a dependency.

Deal with CSV format variations

For example, a CSV exported from a Google Analytics report starts like this:

# ----------------------------------------
# nicolas-hoizey.com
# Viewport et densité d'écran
# 20180501-20180731
# ----------------------------------------

Viewport width,Screen density,Pageviews
1920,1,"3,505"
1440,2,"1,341"
1366,1,"1,194"
375,2,725
360,3,587
  • ; separator
  • comment lines
  • empty lines
  • delimiter (")
  • thousands separator (",")
  • decimal separator ("." in English, "," in French)

Impossible to write results in file

I'm trying to write results in a file with -f option, but I catch this error

Step 2: get variations of image width across viewport widths
Launch headless Chrome
Go to https://www.courbet.test
Checking widths of image main picture.c-block__img > img
Finished at viewport: 1280px
Couldn’t load page located at https://www.courbet.test:
ReferenceError: writeFile is not defined

Did you face this case before?

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.