1

i am developing a web in angularjs. there are approx 42 javascript files which i have to load. Google PageSpeed Insight ask to remove Remove render-blocking JavaScript.

    <script async src="path to file"></script> 

it load files asyn but jquery.js file loading after files which need jquery file.i am stuck because site taking a lot of time to load.Please help.Thanks in advance

1
  • Not to answer your actual question but creating a bundle for those 42 files (I use gulp) helps to improve site performance on loading Commented Feb 18, 2017 at 14:49

2 Answers 2

1

There can be long answer about different ways to implement that (using modules and http://requirejs.org/ or https://github.com/systemjs/systemjs), but TL;DR - try to put jQuery script call inside the head tag of your webpage, while the others scripts in bottom of html page.

Sign up to request clarification or add additional context in comments.

2 Comments

hi, thanks for reply, i am new with angularjs. can you share a piece of code or any link of code example. i am not getting require.js. thanks
Code examples are here: requirejs.org/docs/jquery.html, but it will take effort to update each file in your project to make RequireJS modular approach to work. May be that's not the case for you? Just using CDN and put jQuery on top of the page is much faster way to improve site loading performance
0

Found this discussion which helps to address the pagespeed insights "problem" and improves (in my opinion) the UX. Here is Sander's suggestion:

<div ng-if="false">
  <h1>Loading the application, please hold on</h1>
  <div class='aCssSpinner'</div>
</div>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.