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

Optimize showcase images #5980

Closed
slorber opened this issue Nov 20, 2021 · 6 comments
Closed

Optimize showcase images #5980

slorber opened this issue Nov 20, 2021 · 6 comments
Labels
better engineering Not a bug or feature request

Comments

@slorber
Copy link
Collaborator

slorber commented Nov 20, 2021

Showcase images are too big. CI is slower than it should.

We resize them with ideal image plugin but from time to time we should downscale them on Git too.

Tried a bit different methods already, couldn't find a perfect one but this might be a helpful command

npm install -g sharp-cli
mkdir website/src/data/showcase2
find website/src/data/showcase -type f -name '*.png'  -exec sharp resize 1000 --input {} --output website/src/data/showcase2/{base} \;

@lex111 already provided a CLI command but it doesn't downscale, only optimize: #4901

Using a smaller base-size can help the build be faster on a cold cache due to faster image resizing with the ideal image plugin.

Ideally if we could automate this with the CI, that can be convenient.

@slorber slorber added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Nov 20, 2021
@lex111
Copy link
Contributor

lex111 commented Nov 20, 2021

Maybe this bot https://github.com/marketplace/imgbot is what we need?

@Josh-Cena
Copy link
Collaborator

Imgbot uses lossless compression, but @slorber wants lossy compression because we only use the images at limited sizes. It's certainly achievable, but not sure if we can do that w/ CI. Maybe with @docusaurus-bot?

@Josh-Cena Josh-Cena added better engineering Not a bug or feature request and removed bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Nov 21, 2021
@slorber
Copy link
Collaborator Author

slorber commented Nov 21, 2021

🤷‍♂️ Imgbot looks nice but it doesn't downscale images and I'm not sure it will soon (https://github.com/imgbot/Imgbot/issues/306)

This is not a high priority, but if you have any idea how to solve this we can give it a try


Not 100% related but it similarly it could also be nice to have this bot running on contributors PR to avoid Prettier errors: https://github.com/creyD/prettier_action

(Prettier does not emit good logs on PR, but maybe this "reviewdog" thing can be useful too, see prettier/prettier#6885 (comment))

@slorber
Copy link
Collaborator Author

slorber commented Dec 3, 2021

Seems like our prod site can't deploy after merging a new showcase site with a 400kb image 😅 looking for a temp solution with Netlify for now, and have some ideas to fix this more definitively but it's time-consuming to set-up.

3c54ed2

@Josh-Cena
Copy link
Collaborator

Hmm, we have a few other 2MB+ images... Definitely worth working on

@Josh-Cena
Copy link
Collaborator

Closing this, fixed in #6043. We can investigate automating this in #6882

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
better engineering Not a bug or feature request
Projects
None yet
Development

No branches or pull requests

3 participants