As I work on optimizing my website, I find myself juggling multiple plugins that include jQuery plugins with CSS along with my own JavaScript code.
Currently, the CSS is spread across separate files for each plugin I have downloaded. When needed on a page, I add the necessary code to include them. The same goes for JS files. However, when rendering a complex page with many elements, this results in calling 9 CSS files and 7 or 8 JS files, leading to numerous HTTP requests.
One solution could be consolidating all CSS into one large file to reduce the number of included files. Yet, this might cause the browser to interpret unnecessary styles if certain pages don't require them.
Another approach I'm considering is generating CSS and JS files using PHP. This way, only one JS and one CSS file would be loaded, containing only what is essential for each specific page. Is this strategy too unconventional?
In your opinion, which method should I adopt to effectively reduce the page load time?