babel / website

:globe_with_meridians: The Babel documentation website
https://babeljs.io/docs/en/index.html
MIT License
749 stars 1.3k forks source link

compress svg by SVGO #2837

Closed JLHwung closed 9 months ago

JLHwung commented 9 months ago

In this PR we compressed current svg assets using SVGO.

The netlify will terminate the post-process asset optimization on Oct. 17. The html/js/css are already minified by docusaurus and other tools. So we only have to optimize the SVG assets.

There are quite a few *.png assets as well. I think we can compress them losslessly into WebP, supported by all major browsers, or do that a few years later.

netlify[bot] commented 9 months ago

Deploy Preview for babel-next ready!

Name Link
Latest commit 434bdd71a32ba143aae5dcf59b99c552db7c33bd
Latest deploy log https://app.netlify.com/sites/babel-next/deploys/652594e94855330008f08947
Deploy Preview https://deploy-preview-2837--babel-next.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] commented 9 months ago

Deploy Preview for babel ready!

Name Link
Latest commit 434bdd71a32ba143aae5dcf59b99c552db7c33bd
Latest deploy log https://app.netlify.com/sites/babel/deploys/652594e9c49d3e0008733fcd
Deploy Preview https://deploy-preview-2837--babel.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

nicolo-ribaudo commented 9 months ago

I think we can compress them losslessly into WebP, supported by all major browsers, or do that a few years later.

Can we have both the WebP and PNG versions, using https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset?

JLHwung commented 9 months ago

https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/srcset

The MDN also mentions <picture> element for offering alternative image types: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture. It seems to me the srcset is meant to support different devices with different screen ratios / dpis, etc.