nuxt / nuxt/image

Sizes should be optional

Open
#458 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.5k
Forks
331
Avg merge
19h 52m
Merged PRs (30d)
9

Description

Correct me if I'm wrong, but for a <picture> element in HTML, you don't need the sizes property. A browser can choose which srcset is best, using the real rendered size of the image. So when you define the size of the image in CSS, which you probably should do to avoid any jumping during the image loading, everyhing will just 'work'.

The decision of the browser is probably the best one, because the browsers exactly knowns how large or small the images will be rendered, what the pixel density is and whether the user is connected to wifi, 4G, edge...

Wouldn't it be an option to just define all the expected sizes for an image, without using the 'screens' property? Also there is no real documentation about the 'screens' and 'sizes' settings and how they work, apart from some vague sentences. So that would also be an improvement. E.g. I don't understand how the modifiers (where you can only specify one width and height) works together with 'sizes'. What is the point of defining them both, e.g. <nuxt-picture width="20" height="20" sizes="..." />, and what happens under the hood in choosing the generated sizes?

Thank you for all the work, would be nice if I could help improving this package!

sizes

Specify responsive sizes.

This a space-separated list of screen size/width pairs. You can see a list of the defined screen sizes here ).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the issue's discussion of the element, sizes, screens, and width/height modifiers, then inspect the current package documentation for those settings. Determine whether sizes can be optional and how the generated sizes should behave; done should include an agreed implementation direction and clear documentation of the settings and their interaction.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, nuxt, typescript
Domain
documentation, frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.