html-to-docx icon indicating copy to clipboard operation
html-to-docx copied to clipboard

Refactoring work done

Open Cruaier opened this issue 2 years ago • 4 comments

Hi @privateOmega,

I was delighted stumbling over your lib and took some steps further to improve it a little. My main concern was the bundle size and the usage in a browser. I started to work on it and had some success with it. If you are interested in it please have a look here: https://github.com/Cruaier/html-to-docx. I replaced virtual-dom with htmlparser2, removed all (not anymore) needed dependencies and switched to UintArray and Blob instead of Buffer. Bundling is done with vite instead of rollup (it was working better for me).

I tested my changes with your prepared tests and the result document is pretty much the same. The main benefit is the bundle size though as the artifacts are now less than half the size as before.

Feel free to take my changes (or the parts you like) and put them into your lib.

BR

Cruaier avatar Jan 07 '24 14:01 Cruaier

@Cruaier Can you publish this version into npm I am interested to compare with existing one ? Looks a cool work, thank you !

traycho avatar Mar 20 '24 14:03 traycho

@traycho here you go: https://www.npmjs.com/package/html-to-docx-lite I'll add to it when I have more time

Cruaier avatar Apr 14 '24 11:04 Cruaier