Eliminate render-blocking JavaScript and CSS in above-the-fold content

Hi There,

Is there any way to move the following scripts to the footer??

/assets/js/vendor/modernizr-2.6.2.min.js
http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js

I know that there are some WordPress plugins that insert jQuery in the middle of the page improperly and break things but I’m keeping the plugins to a minimum and want to improve page performance.

Thanks

1 Like

They are both registered in lib/scripts.php. If you change the last param of wp_register_script from false to true, they will load in the footer.

I wouldn’t recommend it though. More so for Modernizr.

hello - did you ever get around this? My client is hell bent on the max score. My scripts are already below the footer so not sure why i’m even getting this issue.

  </footer>
<script src="http://s0.wp.com/wp-content/js/devicepx-jetpack.js?ver=201702"></script>
<script src="/sitecontent/wp-content/plugins/wp-retina-2x/js/retina.min.js?ver=2.0.0"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js?ver=2.1.4"></script>
<script src="/wp-content/themes/ampc-sage-85-theme/dist/scripts/main-cc871eaa88.js"></script>
  </body>
</html>

PageSpeed specifically tells you what files are causing the issue and describes how you can fix them.

Your page has 2 blocking CSS resources. This causes a delay in rendering your page.

Try to defer or asynchronously load blocking resources, or inline the critical portions of those resources directly in the HTML.

As far as your render-blocking JS, those are all 3rd party and not hosted on your site. The same advice applies:

Try to defer or asynchronously load blocking resources

Related threads:

https://discourse.roots.io/t/critical-path-css-with-sage-gulpfile/4618

You’re gonna have to put in some work to get the score that you want

1 Like