We know, using wp_head()
and wp_footer()
all the scripts and styles are enqueued using wp_enqueue_styles
and wp_enqueue_scripts
hook. What we do is to enqueue our stylesheets and scripts using functions.php
. And similarly WordPress plugins also enqueue their stylesheets and scripts using the same method.
So, in the end there are many enqueued styles and scripts in header or footer. What Google PageSpeed recommends is:
Optimize the order of styles and scripts - Google PageSpeed
We know, wp_enqueue_script()
and wp_enqueue_style()
offer a $deps
parameter, where we can define the depth or priority of the script or stylesheet. But that affects only within scripts and styles, not in both. So, with a combined load of scripts and stylesheets from the theme, and/or child theme, and/or plugins, and/or third party API etc. how can we let the WordPress to enqueue them all in a way so that site speed improves with a sound website's quality?
Or, are they bulletproof to echo styles first, than scripts?