Reputation: 415
I have recently run a gtmetrix.com speed test on my website
The main area of focus on my site seems to be style sheets and JS and making fewer HTTP requests. It tells me...
This page has 44 external Javascript scripts. Try combining them into one.
This page has 33 external stylesheets. Try combining them into one.
Is it possible to combine these all into one? I have one style sheet with my child theme, the rest come from the parent theme and Bootstrap CSS/Js.
Also, Does this have much of an effect on the speed of my site?
Upvotes: 0
Views: 267
Reputation: 1079
If your css files are stored on your own server, you can concatenate them into one file in any order. If your js files are stored on your own server, you can also carefully concatenate them into one single file, but the order in which they are concatenated should match the order in which they are called now, relative to themselves and to the html code, just to be safe, so universal stuff like jquery should probably come first, and very specific custom scripts should be appended last. Make sure to encase stuff in $( document ).ready(function() {}), as appropriate.
If your css and js files are stored on external servers as you indicated, then you can either download them and store them locally instead, or you can fetch them all server-side on page load with cURL (or the equivalent for your language) instead of client-side and then assemble them in memory each time you load the page. Not sure why you would do this, because it would take up a lot of server resources and probably make the site run slower, but it is possible.
Realistically, what I would do to improve your speed is, instead of working on concatenating the files, which will not provide much significant benefit, work on seeing which files you actually need and then getting rid of the ones you don't.
Upvotes: 1