Skip to content

Conversation

@FineWolf
Copy link
Contributor

@FineWolf FineWolf commented Jan 6, 2021

Description

This PR add an additional argument to fluid() to allow to optionally remove the original size from the generated srcset.

From the added blurb in gatsby-plugin-sharp's README.md file.

By default, the original image is always added to the generated srcSet. However, if you
want to only generate sizes only up to the largest breakpoint defined in srcSetBreakpoints,
you can set srcSetAlwaysIncludeOriginal to false. Doing so will only generate images up
to the largest breakpoint or up to the original image size, whichever is the smallest.

This setting has also been exposed in gatsby-remark-images, and the appropriate changes have been made to the schema in gatsby-transformer-sharp.

This feature was added in order to support photography portfolios where we want to avoid at all costs to expose the original, full-resolution image. This thus allows the maintainers to safely use gatsby-plugin-sharp without doing any prior preprocessing of the image files.

Documentation

  • This feature has been documented in the internal plugin README.md for gatsby-plugin-sharp.
  • The new option has been documented in the internal plugin README.md for gatsby-remark-images.
  • The default value of srcSetAlwaysIncludeOriginal (true) preserves the original behavior, thus avoiding a breaking change.
  • Unit tests have been updated to test the additional parameter.

Related Issues

There are no related issues.

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jan 6, 2021
@FineWolf FineWolf changed the title Feature/src set include original feat(gatsby-plugin-sharp): allow conditionally including the original size in srcSet Jan 6, 2021
@FineWolf FineWolf changed the title feat(gatsby-plugin-sharp): allow conditionally including the original size in srcSet feat(gatsby-plugin-sharp): new srcSetAlwaysIncludeOriginal parameter for fluid() Jan 6, 2021
@LekoArts LekoArts added topic: sharp type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement. and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jan 11, 2021
@ascorbic
Copy link
Contributor

Thanks. I really dislike the current behaviour (and have removed it in the new resolver). I believe there's an issue open about this somewhere. Just one stylistic nit, and a merge conflict to fix

@FineWolf
Copy link
Contributor Author

@ascorbic Requested changes have been made. Thanks!

@LekoArts LekoArts added topic: media Related to gatsby-plugin-image, or general image/media processing topics and removed topic: sharp labels May 28, 2021
@FineWolf
Copy link
Contributor Author

FineWolf commented Jun 8, 2021

Closing PR, no longer relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: media Related to gatsby-plugin-image, or general image/media processing topics type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants