szdc / brackets-cdn-suggestions

Provides auto-complete suggestions for common scripts/CSS documents hosted by Google (e.g. jQuery, AngularJS)
MIT License
29 stars 3 forks source link

Multiple CDN support (JSDelivr) #3

Closed lenovouser closed 9 years ago

lenovouser commented 9 years ago

Hello Jack,

it would be really nice if you could include the resources from https://cdnjs.com, you can get the list over json (https://cdnjs.com/packages.json). By the way, the JSON file gets loaded way faster over SSL/HTTPS than over HTTP, I think that probably is because of SPDY. So keep that in mind...

jimaek commented 9 years ago

You can also use our API to load multiple other CDNs https://github.com/jsdelivr/api

lenovouser commented 9 years ago

@jimaek :+1:

that seems like a great idea. But how do you handle the same script (e.g. jQuery) over multiple content delivery networks? Maybe let the users choose which cdn they want to use?

jimaek commented 9 years ago

@ApfelUser Sorry im a bit confused. Are you talking about the API or jsDelivr as a CDN?

lenovouser commented 9 years ago

No, I am talking about the fact that e.g. jQuery is hosted on Google CDN, CDNJS, MaxCDN etc. and I hope that the user gets to choose which cdn he wants to use. JSDelivr is no CDN? I thought it is like a index for all resources on all content delivery networks

lenovouser commented 9 years ago

There already exists a plugin which basically does what we want, but it (sorry) looks pretty bad and has a way different concept of using it (no autocomplete, etc.) https://github.com/dnbard/brackets-cdn

jimaek commented 9 years ago
  1. jsDelivr is a CDN itself too. More info https://hacks.mozilla.org/2014/03/jsdelivr-the-advanced-open-source-public-cdn/ We just offer the API as an additional service
  2. All CDNs have a different format so its not possible to request 1 project from all CDNs at the same time. At least not in v1. The user will need to set a preference CDN and then maybe add a failover in case Google for example is not hosting the project he requested.

For example Google http://api.jsdelivr.com/v1/google/libraries/jquery cdnjs http://api.jsdelivr.com/v1/cdnjs/libraries/jquery jsDelivr http://api.jsdelivr.com/v1/jsdelivr/libraries/jquery

lenovouser commented 9 years ago

Sorry, did not know that. The idea with the preference on which cdn to use seems good, but what happens when a library is not available on the chosen cdn? Sorry for my probably bad english - I am not a native speaker...

jimaek commented 9 years ago

Like I said in case of this plugin you can add a settings menu to allow the user to select his preferred CDN and an alternative CDN. For example he selects google so then all requests go to http://api.jsdelivr.com/v1/google/libraries but if Google is not hosting the requested project then the plugin will use the alternative CDN.

Thats my suggestion, its up to @szdc to do what he likes :)

lenovouser commented 9 years ago

:+1:

Well, then let's wait util @szdc responds... :smile:

szdc commented 9 years ago

Hey guys,

Thanks for the comments! Funnily enough this was actually where I planned to take the extension next - I stumbled upon jsDelivr after finishing it last night and noticed the APIs for the CDNs.

As for preferences, building on both of your thoughts:

Thoughts? Feel free to fork and submit PRs once we agree on a general direction, I'm pretty busy over the next couple of days :smiley:

szdc commented 9 years ago

Started work on this issue in branch v2

szdc commented 9 years ago

Added basic functionality 9395ce52757006bcab775f8605d43ca263686970