-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fixes for image sizes #74
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect(convertSizesToWidths('test string 123')).toEqual([]); | ||
expect(convertSizesToWidths('test, 123')).toEqual([]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it maybe throw instead? Just to not cover possible human mistakes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree it makes sense to throw 👍🏻
image, | ||
style, | ||
title, | ||
sizes = '(max-width: 992px) 800px, (max-width: 576px) 400px, 1200px', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the order correct here? Should it not go from the lowest to the highest max-width values?
sizes = '(max-width: 992px) 800px, (max-width: 576px) 400px, 1200px', | |
sizes = '(max-width: 576px) 400px, (max-width: 992px) 800px, 1200px', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if the order actually matters here, couldn't find anything pointing to that 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested this in JSFiddle, and it seems they have to follow the lowest-to-highest order. Otherwise the smaller breakpoint following a larger one will be ignored.
Compare these two:
width
andheight
for images (prevent CLS issues)sizes
string, generate thesrcset
based on thesizes
property