Optimize the order of styles and scripts issue
Trying to squeeze every last ounce of performance for an SEO theme I develop and noticed a clash with the cache 🙂
Using Google Chrome audit tool.
Tools >> Developer Tools : Audits on http://stallion-theme.co.uk/
Found this issue:
Optimize the order of styles and scripts (1) 1 inline script block was found in the head between an external CSS file and another resource. To allow parallel downloading, move the inline script before the external CSS file, or after the next resource.
Looking through my code the cause is I’ve got some inline CSS in the head to load a background image (behind the heading at the top). I added the code close to the top of the head section (next line after the title element) so it’s run before the CSS files are enqueued by WP.
With W3 Total Cache Minification and combining CSS files (have three correctly enqueued CSS files) on the minified CSS file is placed ABOVE the title element (directly after the opening head tag), which means it loads before my inline CSS.
Shouldn’t the minified CSS file be loaded at the bottom of the head section to prevent this?
Is there a fix to have it load this way, want it added before the closing head tag?
I’m thinking about adding inline CSS to render the important parts of the page layout etc… to remove the PageSpeed Insights issue “Your page has 1 blocking CSS resources. This causes a delay in rendering your page.”. If W3 total Cache adds the minified CSS file to the top of the head it will load before my inline rules.
- The topic ‘Optimize the order of styles and scripts issue’ is closed to new replies.