nuxt / image

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

Support for regular sizes attribute #1437

Open AdrianFahrbach opened 2 months ago

AdrianFahrbach commented 2 months ago

Right now I have to use the breakpoints provided by Nuxt (e.g xs, md, sm...) to set my image sizes. This prevents me from using breakpoints outside of the predefined ones and makes it hard to do detailed adjustments.

IMO it also adds an unnecessary abstraction layer that makes using this component more difficult then it should be. Issues like #1413, #1434 and #1433 wouldn't be a thing with the normal behaviour that we are used to.

Are there any technical reasons why it has been implemented in that way? I guess that this makes it easier to work with it in Tailwind, but IMO this package shouldn't be opinionated. I would prefer if the current breakpoint functionality would be optional.

stijns96 commented 2 months ago

The only reason I can think of is the automatically generated srcset. However, even this is on most cases not enough. At my job, I've created something lile this module and concluded that this is really hard to automate.

I use storyblok, and one of the problems already comes with dynamic content. I can set my size to md:50vw which will give me the 1x and 2x of the half of 768px, but imagine that a client is uploading an image of 40px max. The image will not break, but stil it doesn't make sense.

I personally think that I'm better of with an onwly created component for now...