Compress icon indicating copy to clipboard operation
Compress copied to clipboard

Use minify-html

Open fabriziogiordano opened this issue 1 year ago • 3 comments

This is not an issue but a feature request.

I manage a site in astro that builds about 65,000 html files. I used astro-compress for a while and the compression phase time alone was about 45 minutes on a small server.

I recently switched to https://github.com/wilsonzlin/minify-html and now the compression time is 3 minutes, 1.5 orders of magnitude less time. Pretty incredible.

Is it possible to explore the opportunity to use this compress instead of html-minify-terser currently used?

fabriziogiordano avatar Mar 25 '23 23:03 fabriziogiordano

Hi, I have tested it before, but got about the same build times. You can try it out at https://github.com/astro-community/astro-compress/tree/minify-html to see if you have better results. If you have used the rust library that's why you probably noticed the smaller build times.

NikolaRHristov avatar Mar 26 '23 11:03 NikolaRHristov

I will try and report back the results. I have few astro projects running astro-compress with no problem. This new one has 65K index.html files and the rust minification is actually making a difference in terms of speed.

fabriziogiordano avatar Mar 27 '23 20:03 fabriziogiordano

Yeah the rust minification is cool, there aren't many libraries that support HTML minification, but the npm package uses a binding which is slower than the cli.

NikolaRHristov avatar Mar 27 '23 21:03 NikolaRHristov