thegreenwebfoundation / developer-docs

The developer documentation site for The Green Web Foundations open source libraries.
https://developers.thegreenwebfoundation.org
Apache License 2.0
5 stars 12 forks source link

Add image processing to build #13

Closed fershad closed 2 years ago

fershad commented 2 years ago

Currently, images added to the site are not optimised and are served in their original format. This is not great for both performance and sustainability.

Image should be:

To-do:

michael-voit commented 2 years ago

@fershad In my 11ty projects I use https://github.com/saneef/eleventy-plugin-img2picture with very extensive optimizations.

If you like, I can work on that and make a pull request then.

fershad commented 2 years ago

@michael-voit thanks! I was originally thinking about using the official 11ty image plugin but it looks like Img2Picture uses it under the hood & doesn't need a shortcode either.

Would be more than happy for you to create a PR to add it in for us.

michael-voit commented 2 years ago

@fershad I included and tested the img2picture plugin. If we would like to optimize the images as far as possible we would have to use at least an sizes attribute - and for that we would have to insert images with HTML. Would that be ok, than I could also do that - at least as an example at the image on https://developers.thegreenwebfoundation.org/co2js/explainer/methodologies-for-calculating-website-carbon/

Should I do that or open a pull request as it is now?

fershad commented 2 years ago

Go for it @michael-voit, let's optimise image sizes too. Could you please add the sizes attribute to the image on that page & then create a PR.

michael-voit commented 2 years ago

@fershad Here we go: #18

fershad commented 2 years ago

Thank you so much @michael-voit. This is now live on the website, and definitely makes a dent in the page weight where images are present.