Niels-IO / next-image-export-optimizer

Use Next.js advanced <Image/> component with the static export functionality. Optimizes all static images in an additional step after the Next.js static export.
MIT License
460 stars 56 forks source link

Quality of life #114

Closed PeterKottas closed 1 year ago

PeterKottas commented 1 year ago

While contributing recently, I found 2 issues.

  1. The optimizeImages file is plain javascript which makes it a bit harder to work with.
  2. The optimizeImages has now grown to 750+ lines and it's quite hard to keep track of it.

I'd be happy to refactor and fix both if you are up for it. If the reason for you to keep it in plain javascript was to be able to run in directly in example/package.json - "export": "next build && next export && node ../src/optimizeImages.js", note that this can be resolved by using ts-node that can run typescript directly.

Let me know if there are any other reasons.

Niels-IO commented 1 year ago

Hi @PeterKottas,

You are quite right that the optimizeImage.js grew out of proportion. I refactored it and added typescript to it. I still have to test it more, but the code is in #122

PeterKottas commented 1 year ago

Sorry mate, I completely missed the previous comment. Nicely done! I'd have been happy to help as well. Next time ;)