-
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
Add ratio breakpoint functionality #32
Conversation
There’s no need for a separate view for images with placeholder. The only difference to the regular view is the default sizes attribute. This can be handled with a simple if statement and removes lots of code.
There's one drawback to note with this approach. As of now, it's not possible to set the |
Thanks a lot for all the work! I've merged your changes, but did a big refactor and added tests, so Github doesn't recognize the merge anymore. |
Awesome and great refactor too! Excited about the new feature 🎉 |
This PR implements issue #31.
You can now set different ratios for different breakpoints like so:
Each breakpoint adds a
source
element with amedia
attribute containing amin-width media query
. No longer do you have to hide/show images with CSS if you want to use different aspect ratios depending on screen size.If you don't provide a default ratio, the image ratio falls back to the ratio of the original image.
This PR ended up in a much bigger refactor than I first anticipated. Please let me know what you think.