nuxt / image

Plug-and-play image optimization for Nuxt applications.
https://image.nuxt.com
MIT License
1.32k stars 269 forks source link

default sizes #1075

Open tasiotas opened 11 months ago

tasiotas commented 11 months ago

Hi,

Is it possible to define default sizes?

I tried to put it in the preset, but looks like it for modifiers only. Setting custom screens config also isn't the way to go.

Perhaps its not implemented yet? I would like to specify global (or per preset) list of responsive sizes to be generated. '100px md:400px xl:800px' for example

https://stackblitz.com/edit/github-dccw3y?file=nuxt.config.ts

tasiotas commented 11 months ago

same issue with densities and format defined in defineNuxtConfig. They are all being ignored. Only works if I define all those props on the <NuxtImg> or <NuxtPicture>

SuddenDev commented 10 months ago

any update on that? Same issue for me with nuxt@3.8.1 and nuxt/image@1.0.0. Vercel as a nitro provider, but also not working without that or with that on my local M1 Pro Macbook Pro.

Voltra commented 10 months ago

Same here, by default it generates an obscene amount of images (especially with WEBP and/or AVIF support enabled)

everyx commented 9 months ago

Maybe it's not very related to this, but it's also about the default sizes, the latest HTML standard specification has a new sizes=auto option, for loading=lazy images, the browser will automatically request the best image based on the display size, in nuxt image, if sizes is not set, and loading=lazy is enabled, maybe auto will be a good default.

Related Links:

  1. https://html.spec.whatwg.org/#sizes-attributes
  2. https://github.com/whatwg/html/issues/4654
notflip commented 7 months ago

any update on that? Same issue for me with nuxt@3.8.1 and nuxt/image@1.0.0. Vercel as a nitro provider, but also not working without that or with that on my local M1 Pro Macbook Pro.

I'm noticing the same now, the format and quality settings in nuxt.config.ts are just ignored. Has anyone else noticed?