matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.88k stars 2.65k forks source link

[Vue] Performance improvement: use scoped styles and load plugin styles on demand too #18983

Open diosmosis opened 2 years ago

diosmosis commented 2 years ago

Another potential improvement to page load time: all of Matomo's styles are currently loaded synchronously in one request. It doesn't take much time, but there would be a performance improvement, if the file was smaller.

If the styles were moved to Vue modules as scoped styles, then for plugins that are loaded on demand, the styles could be removed from the main merged stylesheet.

To accomplish this:

Refs https://github.com/matomo-org/matomo/issues/18981 & https://github.com/matomo-org/matomo/pull/18980

heurteph-ei commented 2 years ago

AFAIK, load several small files takes more time (and consumes more network resources) than lone one single bigger file... But it depends on the number of (small) files you won't load thanks to your new behavior...

diosmosis commented 2 years ago

Scoped styles are bundled, they are not loaded individually. The bundles would only be loaded individually if Matomo is modified to load them on demand w/ plugin JavaScript. Note that the primary purpose of this issue is to remove/lessen the initial larger synchronous request for styles.