How to combine external JavaScript files on COS


#1

Hello,

I ran a speed test on Pingdom for a COS website and it says there are 7 JavaScript files (not 3rd party) should be combined. How can I achieve this? Any advice or guidance would be greatly appreciated!

Thank you!


#2

Hi @cinanoglu,

Just to make sure that we're on the same page, are these your own custom JS files that you're hosting on the COS? If that's the case, I'd recommend just combining them to a single file in the COS.


#3

Hi @Derek_Gervais, I'm having a similar issue. Please see the Pingdom report for Render Blocking JS: https://tools.pingdom.com/#!/bSaiyY/https://www.portvision.com/

We've combined the code as much as we can, but we're running into issues with a few links still.

For example, a webpage may have five external or separate JS files like YouTube popup, sticky menu, etc. We combine all them in one file, but now our page is loading a CTA, so it called a new JS file (through HubSpot backend). So the issue is happening with our dynamic JS files, which we are unable to combine without breaking the page.

My question is, how can we further combine all the rest of the dynamic JS files into one (or fewer than currently)?

Please advise.


#4

Hi ccjesse,

Looking at your pingdom report, there's a number of custom files you could combine. Those are

As for the others, we are looking at loading the CTA js only once.

There is a Web Pages setting you can turn on that will load jQuery in the footer which will make it non-render blocking. You will need to verify that your pages don't use jQuery before the footer though.

The rest are all async scripts that should not block rendering.