when looking speed initial load of 1 of our websites, have our javascript in combined file, quite large - 90kb. analysis tools out there keep saying "you should switch async not have javascript block rendering of webpage".
this have right before closing body tag today
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script src="/js/script.js"></script> our script depends on jquery. so, question is, better have near 200kb script i.e. jquery concatenated our script know jquery gets loaded before our own script, , have load asynchronously or there way go without involving many third party solutions headjs, reactjs etc.
put in code, this
<script src="/js/combined.js" async></script> better this
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script src="/js/script.js" async></script> does if keep jquery sync, , put our script async or dangerous in sense can't know sure jquery loaded before ours?
or, non-solution, not care , focus on other stuff i.e. worth hunting down last performance gain?
any insights appreciated.
if want make sure own script loads after jquery can add defer attribute.
take @ this:http://www.growingwiththeweb.com/2014/02/async-vs-defer-attributes.html
Comments
Post a Comment