To load the website faster, we need to let the DOM load before fetching non-critical assets of the site. Scenario is :
1) Optimizing CSS Delivery (loading after DOM load)
2) Removing render-blocking JavaScript (various libraries) and load them later.
3) We might have multiple pages where we have custom code which relies on libraries we are using.
4) We do not need to use requirejs or webpack as our only requirement is async loading.
So, we need a plain javascript code which can load the assets asynchronously and fire an event when all of them are loaded. That event can be listened by our custom code which uses library functions.
Aucun commentaire:
Enregistrer un commentaire