Closed shadowtime2000 closed 3 years ago
Yes, it would be great to support ES and UMD, thanks for the suggestion. I will check Rollup, and think about how best to do this.
Is it a bad idea to manually add the ES and UMD build scripts in the package.json
? Similarly like I did for Common JS?
From Rollup docs: "Rollup is a module bundler for JavaScript which compiles small pieces of code into something larger and more complex, such as a library or application."
Currently, Multiavatar is dependency-free and not using any framework. It's not made from small pieces of code, but it is a single monolithic script.
You have mentioned two extremes: manually copy-pasting, or using Rollup. Maybe there is also a middle way, which would be manually creating automated build scripts? Then a single npm run build
could prepare all the three formats.
@giekaton Seems like a good idea, we could create a tools/build.js
which generates all 3 builds in a dist
folder or something. If you want, I can work on that.
That would be great! Thanks for the initiative.
If we need to discuss any details, please join our Telegram channel (https://t.me/multiavatar) or contact me by email.
Maybe the PHP build script from the svg
folder should also go to the tools
folder, and later it can be rewritten in JS to make the build process more seamless and this repository in a single programming language.
More and more people are using ES modules because of their static nature. It would be great if Multiavatar supported that. Support for UMD would also be great so then users of AMD and people who just read off the global object could also use it. There a couple different ways this could be implemented, the most organized being a rollup build setup or something, the least being copy and pasting the same code into different files for different formats.