-
Notifications
You must be signed in to change notification settings - Fork 741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More lightweight Primefaces #8910
Comments
currently this is completely by design and in the past even more JS were aggregated to one big files instead of multiple smaller files. we can remove some not common components from components.js and we can also create issues for deprecate/remove/rewrite single components which uses jquery plugins |
i think we could split up components.css/js in some files:
|
i like this idea a lot! |
I really do not think that this would be worth the effort, both for the maintainers and the consumers. From a short glimpse we would probably omit at most one of these files per page. So we would probably just skip using dedicated JavaScript files. It is also cumbersome to maintain this per page. The ideal solution IMHO would be, that the server side is dynamically generating a per-page js/css file according to components referenced on a page. I have my doubts that this would be feasible. |
yeah but -1 for the dynamic approach, at least in PF; this is better placed in OmniFaces or JSF impls |
The only other option is to do it like PFE does it where each component generates its own JS file like "creditcard.js" and then it makes it per page dynamic of just what components you are using the page. It makes it way more network requests if you have a lot of components but I use OmniFaces CombinedResourceHandler anyway to pack everything on my page to 1 JS file. This is more like the modern idea of Tree Shaking in modern JS frameworks: https://developer.mozilla.org/en-US/docs/Glossary/Tree_shaking |
i dont think that the 1:1 component/js is a good way therefor either leave it as it is or split it up a bit more also the even the 1400kb components.js is just ~480kb with gzip maybe even splitting up components.js into 2 files much better |
Agreed I was just throwing it out there. Even when I compare the GZIPPED stuff from one my production PrimeFaces JSF apps it scores high only Google Lighthouse with all our optimization tricks. So to me we could gain a little bit by breaking it up but @jacekzwroclawia your better bet might be to try my Optimization Guide: https://github.com/melloware/wildfly-faces#optimizations |
Thank you guys for fast brainstorm about the topic. I wrote this post because I saw that in PF10 jquery-plugin.js was 256KB, and in PF11 it is 354KB. My concern was that if there will be more and more components in PF in the future, jquery-plugin.js and components.js are going to be bigger and bigger. I always like that jQuery UI has this option to create custom package contains only widgets that you actually need: https://jqueryui.com/download/ Thank you, @melloware for some seo optimization use cases, could you also put your Google Lighthouse scores for mobile with PF? I wonder how good performance could you got with PF on mobile what is important in actual SEO world. |
@jacekzwroclawia we switched to a new Optimizer plugin for PF 12.0.0 and I just tweaked it so |
@tandraschko wrote:
I like this. To spin the idea further, maybe separating the deprecated components in a release could make sense? Yet I am not sure how much this will gain though. |
In components.js there are 84 widgets, do you know how many of them are deprecated? |
I will take a shot at this tomorrow splitting between two sets of components JS. There are only a couple of deprecated and the largest one is jqury charts which is already in its own Js file. |
Additionally, it is quite easy to choose desired widgets from jquery ui (https://jqueryui.com/download/) - maybe we don't need that much jQuery UI widgets in Primefaces? In PF10 we included 36 jQuery UI (1.12) widgets, and in PF11 we include 47 jQuery UI (1.13) widgets. PF10 - 35 jQuery UI Widgets
PF11 - 47 jQuery UI widgets
|
@stolp about deprecated components: we should just move them into a seperate file for each component and this i would do for all depracted first, then we can go further and check if it makes a huge difference in splitting up components.js into common/uncommon UPDATE: calendar e.g. removes ~100kb from jquery plugins |
Ok I will do this today @tandraschko @jacekzwroclawia yes I just grabbed all jquery widgets when upgrading. I will see if I can make it match 10.0. |
By changing the following things was able to significantly reduce the size of the 2 major JS files
|
Updated for PF 14
|
Description
Actually Primefaces JS files (components.js, jquery-plugin.js) are bigger and bigger along with following releases. In our company we use only few primefaces components, and we want our front to be as fast as possible - yes I know that in that case Primefaces is not the best option, but still we want to stay with it because of many reasons.
Describe the solution you would like
Maybe it will be possible to choose widgets we can enable or disable in settings and then on the front side only needed JS code will be loaded in both components.js and jquery-plugin.js.
Additional context
No response
The text was updated successfully, but these errors were encountered: