-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image size set to 1w
if sizes is set to 100vw
#1433
Comments
Meanwhile I get why. There is no breakpoint to match, but still this should work. I like the way the srcset is build up from the sizes, but sometimes it's works against it. Sometimes it would he better to just have an array of widths that the srcset should be build of. Most of the time you only need a px size if the container reaches it's max width. Everything below should use vw |
It's actually really weird and it's very strange that this issue doesn't have more upvotes as it basically affects all providers. The problem lies in that logic: image/src/runtime/utils/index.ts Lines 128 to 136 in 3175790
For a size input such as "sm: 100vw lg:480px" this function should return a sizes = {
lg: '480px',
sm: '100vw',
} But whenever a size is provided without a media query, this function sets it to 1px in size. So: "100vw lg:480px" will return: sizes = {
'1px': '100vw',
lg: '480px',
} Then further there is some logic that converts the keys to their actual screens values, so the object will be transformed with actual pixel values instead of screen keys, let's says like this: sizes = {
'1px': '100vw',
1280: '480px',
} And finally with default densities being Anyway long story short:
This is a major inconvenience and make this package pretty much useless without a fix. |
Hi @dbismut , Nice explenation! I already moved away from this package... it indeed makes it useless now. |
Do you have a drop in replacement? |
Well, I created my own image component. It's fully based on the Storyblok image service |
Do we really need to specify 100vw on the start? Isn’t enough this? (Related: #267 ) |
Of course this can work but it is fastidious, it's like setting media queries for every breakpoint for each responsive class, that doesn't make sense. Plus it is supposed to work from the docs. Also nuxt/image is confusing breakpoints and screen variants which are two different things. |
Somehow
100vw
will be converted to a1w
and2w
url and I don't understand why.Local
Storyblok
The text was updated successfully, but these errors were encountered: