-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gatsby-image): Placeholder Improvements (#10944)
* feat(gatsby-plugin-sharp): Configurable base64 width Allows for using larger(or smaller) than the default `20px` width, trading size for quality via more/less pixels. Adds the `base64Width` arg to the fixed & fluid nodes. * chore(gatsby-plugin-sharp): Remove magic numbers Provides added clarity for where these numbers are used. Especially for the value of `72` where it's not clear if the value was for image or display density. `defaultBase64Width` improves clarity and keeps it DRY across both usages. * fix(gatsby-image): Support placeholder image with backgroundColor Place the `backgroundColor` div before/behind the placeholder img. * chore(gatsby-image): Share common transitionDelay variable They seem all intended to use the same duration of `0.25s`, `fluid` backgroundColor div actually used `0.35s` for some reason which seemed a possible typo, this corrects that and avoids it in future. * feat(gatsby-plugin-sharp): Allow base64 format to differ, allow WEBP For example, WEBP base64 placeholders with a `backgroundColor` as fallback while using JPG/PNG with WEBP for the `<picture>` element. Adds the `forceBase64Format` config option. Adds support for WEBP base64 images. * chore(gatsby-image): Update test snapshot * feat(gatsby-plugin-sharp): Support base64Width as a config option Allows setting a project wide default, rather than having to request it per image. Updates `defaultBase64Width` to be a function as `pluginOptions` has not initialized when assigned. * feat(gatsby-plugin-sharp): Support forceBase64Format as query arg * Change `density_72PPI` to `defaultImagePPI` Co-Authored-By: polarathene <[email protected]> * Change `density_72PPI` to `defaultImagePPI` 2 Co-Authored-By: polarathene <[email protected]>
- Loading branch information
1 parent
3bc5f4d
commit 44491ef
Showing
4 changed files
with
69 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters