cfjedimaster / brackets-jsdownloader

JSDownloader
15 stars 12 forks source link

Pull libraries from external library CDNs? #17

Open joepie91 opened 10 years ago

joepie91 commented 10 years ago

Right now the list of libraries is fairly limited. Would it not be an idea to, rather than duplicating the effort of maintaining a list of libraries, directly pull lists of libraries from an external library CDN like cdnjs (http://cdnjs.com/packages.json) or jsDelivr (https://github.com/jsdelivr/api), and simply present them in a filter-able list, perhaps with the most popular/common libraries at the top?

cfjedimaster commented 10 years ago

That would be cool. See #15 - I definitely am getting tired of having to republish for every small change. cdnjs.com seems good - but it is missing one of the first things I checked, jquery mobile. (Or I searched for it wrong.)

joepie91 commented 10 years ago

jQuery Mobile shows for me when I search for jquery-mobile. Either way, you could always see if combining them would be a possibility - I guess it would depend on the naming conventions, but perhaps just grabbing the list from both sources and deduplicating the result would be an option.

cfjedimaster commented 10 years ago

Ok, I see it. But if the assets key represents the files, it has more than necessary. For example, we don't need the regular and .min files. One of the things I wanted to avoid with this extension was unnecessary stuff, know what I mean?

joepie91 commented 10 years ago

I've had a look through the packages.json, and it seems that the filename key indicates the primary file to download/include.

Aside from that, a useful heuristic could be to download the following:

  1. The .min version of files that have one. Ignore the non-.min version (ie. ignored_file = filename.replace(".min", "")).
  2. All files of which no .min version exists (these would be extra assets such as images).

While there might be a few packages that this won't work for, it seems to cover most of them.

cfjedimaster commented 10 years ago

Hmm. And if we cache the giant ass package file for 24 hours or so, the index could load quickly. I'm definitely interested now. Do you want to try building this? If not - it may be a while before I can get to it.

joepie91 commented 10 years ago

Hmm. I'm not very familiar with Brackets' extension architecture. If you have a good reference guide for Brackets extension development, I'd be interested in giving it a try - otherwise, I'm not sure I'd have the time to build this...

cfjedimaster commented 10 years ago

You should try it sometime - but this might be a hard one to get started with. :) I'll put it on my TODO.