kkawabat
kkawabat

Reputation: 1697

How to reduce loading time for web pages with lots of scripts

I am trying to develop a website using meteors. My problem is that the website takes a really long time to load (> 2-3 min). When I checked the network tab in "inspect elements" I see that majority of the load time comes from scripts in the folder "/packages/".

I'm not sure if this is abnormal but I have about 90 lines of code that calls for client side scripts most of them are less than 300b.

I am inexperienced with web development so I'm not sure how to improve this, can someone tell me what the problem is and how would I solve it?

Upvotes: 2

Views: 1716

Answers (2)

nilesh93
nilesh93

Reputation: 419

simply, just include your script files and imports at the bottom of the body tag. this way the html and css will load first and JavaScripts will load later in the background , making it faster

Upvotes: 2

Maksym Kozlenko
Maksym Kozlenko

Reputation: 10363

  • Merge multiple scrips into single file - most important in your case to minimize number of HTTP requests
  • Minify/compress JS file
  • Serve this file from CDN

Tools

  • node-minify
  • Cloudflare - essentially you can serve all your pages through them and they will do optimizations for you

Upvotes: 2

Related Questions