Search code examples
pagespeed

Why does google pagespeed insights think my CSS isn't minified and my js isn't deferred?


On my site I've minified the css and the .js file at the end of the page is set to defer.

However, Google pagespeed still complains that the .js is not deferred. Do I have to set the script to async AND defer?


Solution

  • Google says you can reduce your CSS file by 326 bytes. I ran your CSS file through a minifier which reduced it by 1282. There are comments in your CSS file, for example. Try minifying it again.

    Regarding deferring JavaScript, Google's notes suggest they might be expecting <script defer async> instead of just <script defer>. This question explains the difference – it has to do with whether multiple scripts will load in order.