Adding Fallback.js

Hey guys.

I used to add my js files like mention in here: Best way to add a JavaScript library

Nevertheless, I’ll like to try adding CDNs to the common libraries (or at least for me) such as , bootstrap, font-awesome, google-fonts, datatables, etc.

I will like to add js library to my code, which allows you to use cdn for your scripts, with a fallback to local repositories in case of a problem. Similar to what is already done by Roots with Jquery.

Since, I used to add my custom scripts on the JsFileList in the GruntFile, it would automatically be concatenated and minified, and it will always charge on the page. In case, I decide not to add my script on JsFileList it would not be minified.

My question is: Is there a best practice to what I’m trying to achieve? Have someone else already used fallback.js? if yes, what do you think about it?

Roots best practice is to install third party scripts via Bower.

Yes, thats what I’ve been using, but have you ever used a cdn library with a fallback on the bower installation?

while interesting for niche applications, I think this might prove to be a burden when used in conjunction with wp_enqueue of scripts.

If I was coding a simple “brochure site” with no real CMS I would use this though.

You are right ewafford, the idea is good, but I havent been able to integrate it correctly with wordpress and roots way of doing things. I guess for the moment is to much of a burden.