I'm working on a task that I consider a kind of challenge. So, that's the deal.
I need to programmatically determine which clientlib to use. for example, if a website has already the AngularJS then I would call a specific clientlib with a non-AngularJS dependency and vice-versa,
This could be used on a website where AngularJS is already used, and it could be used on a website where AngularJS is not being used (and needed as a dependency).
If you guys could help me with this, I really would appreciate it.
Thanks for sharing.
Have a good one!!!
It is not recommended to create conditional logic or wrapper to decide which Script/CSS/Client lib to be used. As this introduce delays in the process and might be technically not supported.
Whereas we can certainly do this by creating conditionally lading of JS:
var head = document.getElementsByTagName('head');
var js = document.createElement("script");
if (condetion 1)
js.src = "js/jquery_computer.js";
js.src = "js/mobile_version.js";
Related Reference post:- Using common template for differnt project having different css
Kautuk is 100% correct