-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat(gatsby-remark-images): Add flag to suppress css background-image to prevent FOUB #17154
feat(gatsby-remark-images): Add flag to suppress css background-image to prevent FOUB #17154
Conversation
…y-remark-images-add-flag-to-disable-bg-img-on-images-w-transparency
…y-remark-images-add-flag-to-disable-bg-img-on-images-w-transparency
…y-remark-images-add-flag-to-disable-bg-img-on-images-w-transparency
…y-remark-images-add-flag-to-disable-bg-img-on-images-w-transparency
…y-remark-images-add-flag-to-disable-bg-img-on-images-w-transparency
…y-remark-images-add-flag-to-disable-bg-img-on-images-w-transparency
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.
This looks good! Thanks for taking this on. I've added a few nits.
Co-Authored-By: Ward Peeters <[email protected]>
Thanks for the code review. I've made the necessary changes. |
ok sweet, thanks. Doing a quick test and I'll merge right after! Thank you for doing this and for your patience. |
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.
It works and you'll have to enable it to take effect so 👍. thank you for your time!
@wardpeet - Although this PR got merged into master and gatsby-remark-images doc shows the new |
I just confirmed that this PR got merged into master 😄 |
Description
This PR makes changes to gatsby-plugin-sharp and gatsby-remark-images in order to address issue #16516.
I created a new option for
gatsby-remark-images
plugin calleddisableBgImageOnAlpha
which is disabled by default. WhendisableBgImageOnAlpha
is enabled (i.e., set totrue
), it will check the image file for opacity/transparency. If the image contains transparency, then thebackground-image
css property is disabled on<span class="gatsby-resp-image-background-image"></span>
, which will prevent the "flash of ugly blur-up" (FOUB).The reason why I made changes to
gatsby-plugin-sharp
is to expose stats, which is how I determine whether the image contains transparency.Related Issues
Fixes #16516