Hey,

It would be cool if there was support for additional CDN's.

At a bare minimum I would love to be able to use:
* http://cdnjs.com/
* http://code.jquery.com/

Perhaps even being able to add a custom CDN/list of CDN's to load from?

Also, being able to select which version of each package you want to load (and maybe even from which CDN) would be cool/

Cheers,

Glenn

Comments

johnv’s picture

IMO this is supported,
See /admin/config/development/jquery_update .

ericduran’s picture

Yep, I agree. These 2 CDNs aren't currently in the list.

Patches welcome.

lunatic’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Issue summary: View changes
Status: Active » Needs review
FileSize
1.92 KB

hi

here is a patch to support CDNjs in the 3.x branch

AFAIK code.jquery.com is already supported

lunatic’s picture

here is a patch for 2.7 stable version

mrP’s picture

@lunatic for 3.x, it looks like its missing jquery migrate -- https://cdnjs.com/libraries/jquery-migrate

amme’s picture

markcarver’s picture

Title: Support multiple CDN's » Better CDN support
Status: Needs review » Needs work

This is going to be a catch all issue for all related CDN requests.

markcarver’s picture

Title: Better CDN support » Better CDN/API/automation support

I really think that this "including jQuery source files in this project" is getting really old and tedious. It makes the project bloated and a maintenance burden. Not to mention ginormous "patches".

I'd really like to add support for https://www.drupal.org/project/libraries_cdn, which could help automate a LOT of this module's code.

The unfortunate downside is that it depends on 3 additional modules, which would make 4 for just this one and the biggest advantage of this module is that you can install it and (most of the time) it "just works".

---

I still really like the idea of parsing an API, which we can do with the jsDelivr API as it already supports querying against all the CDN's this module supports.

This would allow us to get rid of static versions entirely and avoid the whole "jQuery Update is stale" problem we seem to have quite a lot of.

We could even save the selected CDN choice(es) to the filesystem for "local backup" like it's currently done, but just using Drupal's file API (e.g. sites/default/files, etc).

This would essentially allow us to remove ALL of the source files currently committed in the repo and would, effectively, shut down the concerns made in #1857042: [jquery_update] 3rd party libraries.

---

Also, I actually already implemented something very similar like this in the Bootstrap base theme and it's been wildly successful :D.

You can see the various functions used for this at https://drupal-bootstrap.org/api/bootstrap/includes%21cdn.inc/7

markcarver’s picture

As was discovered in #2860158: Re-add jQuery Form 4.2.1, we'll also need a way to exclude certain versions that we know are 100% incompatible with Drupal from being selected.