1

Question How to get rid of the components' JS and CSS code which are not used by the application and are loaded on every page in components.js and components.css?

Problem Primefaces loads on every page two big JS files (components.js and jquery-plugins.js, ~140KB) and for every component it loads additional JS and CSS file. Loading the lightweight page with one basic component results in several JS and CSS requests which noticeably slows down the DOM loading. The JS and CSS code of components which is not used in the page (or even in whole application) is loaded on every page.

What I tried: - I tried the OmniFaces CombinedResourcesHandler. I finished up with 200KB JS file but the download time and JS processing time took about 30% of DOM loading. Combined resources are loaded from /javax.faces.resource/ and I did not find out how to load them from CDN as those resources are generated automaticaly.

  • 2
    Sounds like you may want to defer loading: http://stackoverflow.com/questions/23173639/defer-loading-and-parsing-of-primefaces-javascript-files – frontsideup Oct 15 '16 at 11:02
  • Thanks for your answer. I finally gave it a try and it works nicely. I reduced the DOM loading times by 36% on the main page (895ms -> 571ms) and by 50% on the other page: 1424ms -> 708ms – Jose Saramango Nov 12 '16 at 17:02
  • No probs, great stats ;). – frontsideup Nov 12 '16 at 18:13

0 Answers0