btford / grunt-google-cdn

58 stars 50 forks source link

Upgrade to google-cdn v0.2 #35

Closed passy closed 10 years ago

passy commented 11 years ago

I spent some hours this weekend adding support for different CDNs to google-cdn (which should definitely be renamed). I also got rid of the hard-coded main files and resolve them through bower, which required an API change to an asynchronous interface.

Currently only CDNJS is supported, because JSdelivr does not expose any but the most recent version and doesn't have main file. I guess I could work around both those limitations, but wanted to get this out as a first step.

/cc @btford /fixes #30

adarshaj commented 11 years ago

:+1: This looks great!

jimaek commented 11 years ago

Hey, actually jsDelivr offers these files http://api.jsdelivr.com/packages.php JSON http://www.jsdelivr.com/hash.xml XML

passy commented 11 years ago

@jimaek What we currently need for this to work is a single main file. For the jQuery package for example, there are three files and I don't know which one of them to use to replace the reference in the source with.

jimaek commented 11 years ago

@passy Oh I see, if you want I can build a custom file for you to use.

passy commented 11 years ago

@jimaek That would be wonderful.

jimaek commented 11 years ago

@passy Actually as I can see http://api.jsdelivr.com/packages.php serves only the latest version. I wrote it a long time ago so kinda forgot.

passy commented 11 years ago

@jimaek That's actually another problem. Ideally we would get something back like on cdnjs which includes all available versions and one main filename of the package.

jimaek commented 11 years ago

@passy Ok, do you want it be JSON?

passy commented 11 years ago

@jimaek Yes, JSON would be my favorite option. :)

jimaek commented 11 years ago

@passy How about this http://api.jsdelivr.com/packagesmain.php ?

passy commented 11 years ago

@jimaek Getting a 500 at the moment. :/

passy commented 11 years ago

@jimaek Yay, I got the whole file now. Having all the version information is great already. I may just be looking at the wrong place, but where is the main property?

jimaek commented 11 years ago

What do you main property? cdnjs doesn't have one either. I added "lastversion" plus to assets added a list of all versions+files. I thought that's what you needed.

passy commented 11 years ago

@jimaek Oh, sorry. From the module's perspective I just know that there is a reference to a particular version of a module, let's say jquery 2.0.3. That's all I know. Without a "main" property, like CDNJS provides it, I don't know what to replace it with. It could be either jquery-2.0.3.js, jquery-2.0.3.min.js or jquery-2.0.3.min.map. That's what I need some reference to a "main" file for.

jimaek commented 11 years ago

I see what you mean. Unfortunately this is not possible. It needs too much manpower to do this. And jsDelivr community is not that big yet.

passy commented 11 years ago

@jimaek That's totally understandable. If you provide this at some point or maybe even just for a handful of libraries, please let me know. :)

passy commented 11 years ago

@btford Ping. :)

tlvince commented 10 years ago

:+1:

santialbo commented 10 years ago

Not trying to be rude, but it's been three months already and this PR is quite cool. Please merge and update package.

passy commented 10 years ago

caugh @btford caugh

If you don't have time, I can test this again and release it next weekend or so.

ksummerlin commented 10 years ago

Let's get this done so the default isn't Angular 1.0.7 any longer.

sdemjanenko commented 10 years ago

This change is awesome. Please pull it!

randallagordon commented 10 years ago

+1 for pulling this in! I chased around trying to determine why Angular wasn't getting swapped out properly for more of my afternoon than I should admit... Pointed the grunt-google-cdn dependency in my package.json to @passy's branch, npm up grunt-google-cdn and all is well and working as expected. Thanks!

danielmcormond commented 10 years ago

Thanks @passy! I have been using your fork because I need AngularJS 1.0.8.

It usually works, but occasionally I get this warning:

Warning: bower exited non-zero with 8 Use --force to continue.

I'm guessing that might be related to intermittent Bower registry availability?

jimaek commented 10 years ago

@passy Its been a while but here you go https://github.com/jsdelivr/api Its in beta testing right now. Check it out and let me know if there is anything missing. The opinion of a developer would be very useful to us.

We also now support the loading of multiple libraries over a single HTTP request Plus version aliases

Let me know if this is enough for a jsDelivr integration :)

shahata commented 10 years ago

@jimaek @passy, cdnify using jsDelivr is now possible using jsdelivr-cdn-data (and google-cdn v0.3 which sadly is not supported yet by this repo)

mpxc8102 commented 10 years ago

To point the grunt-google-cdn dependency in your package.json to @passy's branch, like @randallagordon said, use:

"grunt-google-cdn": "git://github.com/passy/grunt-google-cdn.git#upgrade-0.2"

(Might save those of us just getting our feet wet w/ npm a few minutes. :)

+1 for pulling