-
Notifications
You must be signed in to change notification settings - Fork 22
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
Compress field images with oxipng #103
Conversation
I think this is a good improvement to add. I'd prefer adding this as a GitHub CI action so it doesn't have to be done manually when new images are added |
a1523d3
to
866ee3c
Compare
I used oxipng with the arguments `-Z -o max --fast` to compress each image. This reduced the size of the field images by ~50%, and reduced the size of the whole app by ~25%.
The CI workflow has been added as a comment command |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #103 +/- ##
=======================================
Coverage 63.94% 63.94%
=======================================
Files 77 77
Lines 7983 7983
=======================================
Hits 5105 5105
Misses 2878 2878 ☔ View full report in Codecov by Sentry. |
What I was originally thinking for the CI is for it to compress the images before building, that way it's done automatically without any need for comment commands or github tokens. This way works too but I'd prefer making the compression an internal step before the CI build. |
We’d need a token anyways to be able to push commits and I’m not a big fan of adding commits to a PR automatically. The compression process also takes several minutes (20+ per image), and I don’t want to hold up a build just for that. I think just running an optimize command every time a PNG is modified/added is a good compromise (I doubt PNGs are modified/added often anyways). |
Since it takes that long to optimize the images I think it's best to just remove the CI do the compression manually. You're right that there's only a new image once a year, and now that I think of it, trying to simplify it ends up creating more work. I appreciate your work on this I think this is a good enhancement |
I used oxipng with the arguments
-Z -o max --fast
to compress each image, then a second pass with-o max --fast --strip safe
to squeeze a few more bytes out. This reduced the size of the field images by ~50%, and reduced the size of the whole app by ~25%.