facebook / docusaurus

Easy to maintain open source documentation websites.
https://docusaurus.io
MIT License
56.57k stars 8.49k forks source link

Generated static files are not optimized #568

Closed yangshun closed 5 years ago

yangshun commented 6 years ago

Is this a bug report?

No

Have you read the Contributing Guidelines on issues?

Yes

Proposal

The generated static files in the build directory upon running yarn build are not minified, which can cause longer load times. Ideally, Docusaurus should have an asset minification pipeline that:

ahmadalfy commented 6 years ago

@yangshun I would like to claim the image optimization part. I made some progress that looks good! I integrated imagemin > optipng. Checkout the size difference on the screenshot below 🎆

image

I still need to add optimization for SVG and jpg 🕺

ahmadalfy commented 6 years ago

By the way it increased the build time a few seconds but it is normal.

yangshun commented 6 years ago

Cool, it's all yours! Yeah more processing definitely takes time. We can add in a flag for compression in the build command that is set to true by default.

On Mon, May 7, 2018, 6:58 PM Ahmad Alfy notifications@github.com wrote:

By the way it increased the build time a few seconds but it is normal.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/facebook/Docusaurus/issues/568#issuecomment-387260349, or mute the thread https://github.com/notifications/unsubscribe-auth/ABQRHTVeBf4ZUYCZfBjSUGBnNtweOsS6ks5twPuugaJpZM4TVs7q .

yangshun commented 6 years ago

Gosh, BlueWhale.png is 1.3MB. If you don't mind, please help to compress the original image asset down to < 100kb in your PR too 👍

ahmadalfy commented 6 years ago

Yes I was going to replace all the original images with the optimized ones in the PR as well 😁

ahmadalfy commented 6 years ago

I successfully integrated:

  1. imagemin-jpgtrarns for jpg images
  2. imagemin-optipng for png images
  3. imagemin-svgo for svg images
  4. imagemin-gifsicle for gif images

Once we are done with this PR I will push it.

The total size of the images was 4.4 MB and now after the introduction of the images compressors is 2.3 MB

ahmadalfy commented 6 years ago

Should we update the list and remove optimizing the images?

yangshun commented 6 years ago

Ok checked "Optimized images". Thanks for reminding

yangshun commented 6 years ago

If anyone wants to take charge of the HTML minification it would be much appreciated 😄

ahmadalfy commented 6 years ago

Let me take care of that 😃

On Wed, Jun 13, 2018 at 5:26 AM Yangshun Tay notifications@github.com wrote:

If anyone wants to take charge of the HTML minification it would be much appreciated 😄

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/facebook/Docusaurus/issues/568#issuecomment-396802046, or mute the thread https://github.com/notifications/unsubscribe-auth/AAFWO_rixz54bt_hIj2h2a6yVWd8xPVPks5t8IZpgaJpZM4TVs7q .

-- Ahmad Alfy

alfy.me

yangshun commented 6 years ago

@ahmadalfy How's your progress for this task? Let us know how we can help. If you are no longer available for this task, just let us know and we can free it up for someone else. Do keep us updated 😄

ahmadalfy commented 6 years ago

My bad I got hooked with other stuff. Give me one more trial this week and I will get it done

endiliey commented 5 years ago

Closing due to stale. Let's free this up. We are getting closer to next major version anyway :)