Skip to content
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-plugin-sharp): reduce encoding time and install size #32851

Merged
merged 2 commits into from
Aug 20, 2021

Conversation

lovell
Copy link
Contributor

@lovell lovell commented Aug 19, 2021

Description

Related Issues

Fixes #31792

- Upgrade sharp to v0.29.0
- Replace use of imagemin with sharp equivalents
- Reduces JPEG, PNG and AVIF encoding time by up to 50%
- Reduces install size/time by ~10% (~19MB smaller)
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Aug 19, 2021
@lovell
Copy link
Contributor Author

lovell commented Aug 19, 2021

The windows_unit_tests failure is, I suspect, due to the use of a (shared?) npm cache in CircleCI colliding with lovell/sharp#2848. If there's a way to manually clear this cache then it should work when re-run.

@LekoArts LekoArts added topic: media Related to gatsby-plugin-image, or general image/media processing topics and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Aug 19, 2021
@LekoArts
Copy link
Contributor

Removes GPLv3 code from the dependency graph

So this is in our plugin, not sharp itself?

@lovell
Copy link
Contributor Author

lovell commented Aug 19, 2021

So this is in our plugin, not sharp itself?

Yes, this PR removes the GPLv3 pngquant-bin dependency from Gatsby via the removal of imagemin-pngquant. sharp has never shipped GPL code, and now provides the same features via the BSD-2-Clause https://github.com/lovell/libimagequant

@pieh
Copy link
Contributor

pieh commented Aug 19, 2021

The windows_unit_tests failure is, I suspect, due to the use of a (shared?) npm cache in CircleCI colliding with lovell/sharp#2848. If there's a way to manually clear this cache then it should work when re-run.

I checked syncinc version of sharp used in all packages and that seemed to the trick ( #32852 temporary PR that runs those tests with my small change). I opened PR with this change against your branch in lovell#1 (tho I didn't yet check wether there are any breaking changes in 0.29 those other packages might need to address)

Copy link
Contributor

@LekoArts LekoArts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! We'll merge and publish under next tag and before the 3.13 release check is everything works :) Thanks for your work!

@LekoArts LekoArts merged commit ddcfbd8 into gatsbyjs:master Aug 20, 2021
@lovell lovell deleted the plugin-sharp-v0.29.0 branch August 20, 2021 15:01
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[gatsby-plugin-image, sharp] Black border is added directly to an image
3 participants