-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
suggested srcset sizes are failing the linter #43
Comments
The linter says that your image is 208 pixels wide if your viewport (browser window) has a width of 320. In your sizes attribute you defined that the image has a width of
So it looks like your |
Hi Ausi - thanks for a great tool! If I use chrome devtools to set the viewport to 320, the image is indeed 208 pixels wide. So, the sizes attribute appears wrong. But I'm using the sizes attribute that respimagelint suggested...
The reason I'm playing with respimagelint is that I was hoping it would calculate the sizes attribute for me. But I'm not sure if I'm misunderstanding, if the i'm doing something wrong or if respimagelint is making a mistake when it calculates the sizes. |
Oh I see. It’s intresting that respimagelint itself suggests to use |
Sure. I'm working on an old site, where the frontend was written by someone else. So, don't judge me! At some point I plan to rebuild it properly but at the moment I'm just patching what I've inherited. It's tricky because the image sizes seem to jump around a lot as the viewport changes which is why I'm looking for a tool to calculate the sizes attribute for me. At the moment, the live version of the site doesn't use responsive images. So, you can see an example page here but respimagelint won't suggest the sizes attribute for you. The only change on my local machine is that I've switched out the main product img tag (the image in the div with id 'zoom_img') for one with a srcset and sizes attribute in the format of my original post. That's the image which respimagelint is suggesting the sizes attribute for, which then fails it's own test. Thanks for taking a look. |
The width of the image on your webpage also depends on the height of the viewport. The linter can currently not detect such cases and is not able to calculate the correct |
When I run the bookmarklet on an image with a srcset using w values, it suggests a sizes attribute but when I use the suggested sizes attribute, the test still fails...
Are the bookmarklet generated sizes wrong? Or am I doing something wrong?
The text was updated successfully, but these errors were encountered: