0

In site optimization and after testing its speed on pingdom and others it says to combine external JavaScript files. How can I combine them?

Here are the following files which it says to combine, but I have no idea how to combine them.

There are 2 JavaScript files served from mc.yandex.ru. They should be combined into as few files as possible.
https://mc.yandex.ru/metrika/tag.js
https://mc.yandex.ru/watch/47716165/1?wmode=7&p ... 0%26%20Reviews%20in%20UAE%20%7C%20YallaMotor.com

There are 2 JavaScript files served from static.adsafeprotected.com. They should be combined into as few files as possible.
https://static.adsafeprotected.com/sca.17.4.95.js
https://static.adsafeprotected.com/skeleton.js

There are 2 JavaScript files served from www.gstatic.com. They should be combined into as few files as possible.
https://www.gstatic.com/firebasejs/4.10.1/firebase-app.js
https://www.gstatic.com/firebasejs/4.10.1/firebase-messaging.js

How can I combine them into one file?

karel
  • 5,489
  • 46
  • 45
  • 50
Haseeb Ahmad
  • 7,914
  • 12
  • 55
  • 133
  • 4
    If they are served from CDNs, as they appear to be, you can't combine them. If you really want to combine them, you have to download them, merge them either by hand or with a task automation tool (Gulp...) and then serve the combined file from your own server. – Jeremy Thille Aug 01 '18 at 14:35

1 Answers1

0

Combine Javascript files

JavaScript can be combined by using predecessors. Gulp is one of the processor.
If using gulp, there is a package called gulp concat, it should be imported first, and we can simply concat multiple JavaScript files into one. So script file will be one.

See this question about gulp: Using Gulp to Concatenate and Uglify files .

Steps are very simple

1) Import the gulp
2) Add the files
3) Add the destination in the .dest().

But you should download the js files, and add it to your local path.

saifudeen ni
  • 145
  • 9