I have some libraries (like semantic ui, jquery...) that I usually load separately in my <HEAD>
tag directly from a CDN, each library with its own <SCRIPT>
tag.
I then tried opening the contents of each JS file, copied each one and appened each content to a local single blank JS file. Then I imported this single file in my project. Ok, it worked fine and no errors on console. BUT somethings are not working.
Checking the NETWORK tab of Chrome Dev Tools I discovred that those libraries also try to download many css/image files dynamicaly. The browser tries to download those resources from my local domain, instead of the CDN - of course. So I would have to move all those files to my local server too.
But my question is this: is there anyway I can use something similar to the BASE
tag, but to scripts?
For example, my single.js
would be like this:
base_download = 'cdnjs.cloudflare.com';
//HERE COMES THE CONTENT OF JQUERY LIBRARY
//...
base_download = 'cdn.jsdelivr.com';
//HERE COMES THE CONTENT OF SEMANTIC UI LIBRARY
//...
base_download = 'cdnjs.cloudflare.com';
//HERE COMES THE CONTENT OF THE ANIMATE JS LIBRARY
//...
So the browser would know correctly where to download the content that each js code requests.
If I was not clear I say sorry and I am here to clarify whatever you need!