notiflix / Notiflix

Notiflix is a pure JavaScript library for client-side non-blocking notifications, popup boxes, loading indicators, and more that makes your web projects much better.

Home Page:https://notiflix.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FEAT] - modules for CDN scripts

CodeWithOz opened this issue · comments

Is your feature request related to a problem? Please describe.
No it's not related to a problem per se, more about the size of the package. Currently this library allows importing the different modules if the lib is being used with es6 modules. However, using it with a script tag means the entire library must be loaded.

Describe the solution you'd like
I'd like to be able to exclude modules I don't use, for instance using a build process where I can specify the modules I use and only those get included in the generated script.

Describe alternatives you've considered
Something like Zepto's script builder.

Additional context
N/A

Hi @CodeWithOz

Firstly thanks for using the Notiflix.

The distribution (minified) version of the Notiflix (All In One, with CSS as internal) is just 95kb (CDN script, etc.). And it is just 15.8kb as GZIP(compressed).

As you recommended; if the modules can be separated as script files for the CDN etc. it would be nice as well. But this is a big effort to get a small gain.

I noted this request for future updates. But now, I think there is nothing to do about that.

Thanks for your understanding.

Have a nice work.

Furkan.

@furcan thanks for considering, I understand why you feel that way, and this is an open-source project so you have to manage your time as well. However, I think there's a bigger benefit than you think, because 95KB minified is a lot of script for a browser to parse on one library, even if gzipping reduces the download size. You can check out this video from ~6:43 to 7:15. 100kb of JS for the entire page already has ~4s for the page to be interactive, so if your library takes up that entire budget it can be a performance bottleneck. I'm considering using your library in a Cordova app, so I don't have the luxury of gzipping (all scripts should be bundled within the app instead of fetching from the network), so on a mobile device such a big script is not desirable. Keep up the good work!

Hi @CodeWithOz

With v3.1.0 you can use each module via CDN as well.
https://github.com/notiflix/Notiflix/releases/tag/v3.1.0

Thanks.
Furkan.