-
Notifications
You must be signed in to change notification settings - Fork 346
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
Enforce all images in wechaty website to use .webp
format
#1035
Comments
Hi, @huan this is a great idea. Implementing this will help in making consistency across the images and also since WebP lossless images are smaller in size than PNGs and other image formats so will enhance the rendering. I tried converting the image locally using cwep. It is a WebP encoder that can be invoked with the I have written a simple UNIX script to convert other image extensions to find ./ -type f -name '*.jpeg' -exec sh -c 'cwebp -q 100 $1 -o "${1%.jpeg}.webp"' _ {} \;
find ./ -type f -name '*.jpg' -exec sh -c 'cwebp -q 100 $1 -o "${1%.jpg}.webp"' _ {} \;
find ./ -type f -name '*.png' -exec sh -c 'cwebp -q 100 $1 -o "${1%.png}.webp"' _ {} \; The above UNIX script converts all images of the directory into find . -type f \( -iname '*.jpeg' -o -iname '*.jpg' -o -iname '*.png' \) -delete After this we have to update the URLs and image links in documents so to do this we can use regular expressions. |
Thank you @iamrajiv for supporting this decision, and your huan@dev:~/wechaty/wechaty.js.org/docusaurus/static/img/docs/quick-start$ ls
cloud_shell_editor.png trust_the_repo.png wait_for_provisioning_to_complete.png
huan@dev:~/wechaty/wechaty.js.org/docusaurus/static/img/docs/quick-start$ find ./ -type f -name '*.png' -exec sh -c 'cwebp -q 100 $1 -o "${1%.png}.webp"' _ {} \;
Saving file './wait_for_provisioning_to_complete.webp'
File: ./wait_for_provisioning_to_complete.png
#... I have just added a new unit test for enforcing this issue: the CI will not be passed in the future if we are using other image format than the perfect And we have lots of old images need to be fixed, I have put them in a to be fixed list at https://github.com/wechaty/wechaty.js.org/blob/master/tests/workaround.ts . It seems that we need a volunteer to help the community to analytics those list, and at least do the following steps to improve them:
@iamrajiv would you like to try this for the community? this is really a huge task, but I believe it can be done with the help of some smart scripts. |
Yeah, sure @huan will try this out. Also, I would suggest making the PR review easy let's break this task into subtasks:
|
@iamrajiv it's great to know that you will try it out, thanks for taking this huge job for the community! I agree with you that the best practice is to use PR to submit the changes, and Jekyll and docusaurus can be split as well, and it would be better if we can split all the changes to small groups so that we can have more small PRs. |
Because the
.webp
format has lots of advantages and the safari has supported it last year which means all the modern browsers will be able to compatible with it.The plan is:
.gif
,.jpg
,.png
, etc..webp
and update all the references in all files.Please feel free to let me know if you have any comments by replying to this issue.
.webp
format and updated the corresponding links..webp
format and updated the corresponding links:.webp
format and updated the corresponding links..webp
format which are in the root directory of the repository..webp
format and pages do not have broken links. Also, update https://github.com/wechaty/wechaty.js.org/blob/master/tests/workaround.ts accordingly.The text was updated successfully, but these errors were encountered: