Is there a way to reliably grab the 'latest' version of a lib directly via a URL? #423

Closed
jannisg opened this Issue Sep 12, 2012 · 8 comments

Comments

Projects
None yet
4 participants
@jannisg

jannisg commented Sep 12, 2012

I'm using Sublime Text 2 and the Nettuts Fetch plugin which can fetch resources via a URL, at the moment trying to get the latest version of Modernizr proves difficult as there doesn't seem to be a single URL that would auto server the 'latest' version of this script…

Currently I'm querying the url: "http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.1/modernizr.min.js" directly but the moment 2.6.2 comes out I will still be referencing 2.6.1.

Is there a better way to grab the "latest" of a given library?

Something like: "http://cdnjs.cloudflare.com/ajax/libs/modernizr/latest/modernizr.min.js" where the latest folder would always contain the most up to date version of that lib would be nice.

Any thoughts on this or a better way for me to do what I'd like to do here?

Thanks for reading.

@thomasdavis

This comment has been minimized.

Show comment
Hide comment
@thomasdavis

thomasdavis Sep 12, 2012

Member

Will get back to you with a more thorough answer, in the mean time there is
already a Sublime 2 cdnjs package you can check out.

On Thu, Sep 13, 2012 at 8:26 AM, Jannis Gundermann <notifications@github.com

wrote:

I'm using Sublime Text 2 and the Nettuts Fetch plugin which can fetch
resources via a URL, at the moment trying to get the latest version of
Modernizr proves difficult as there doesn't seem to be a single URL that
would auto server the 'latest' version of this script…

Currently I'm querying the url: "
http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.1/modernizr.min.js"directly but the moment
2.6.2 comes out I will still be referencing 2.6.1.

Is there a better way to grab the "latest" of a given library?

Something like: "
http://cdnjs.cloudflare.com/ajax/libs/modernizr/latest/modernizr.min.js"where the latest folder would always contain the most up to date version of
that lib would be nice.

Any thoughts on this or a better way for me to do what I'd like to do here?

Thanks for reading.


Reply to this email directly or view it on GitHubhttps://github.com/cdnjs/cdnjs/issues/423.

Member

thomasdavis commented Sep 12, 2012

Will get back to you with a more thorough answer, in the mean time there is
already a Sublime 2 cdnjs package you can check out.

On Thu, Sep 13, 2012 at 8:26 AM, Jannis Gundermann <notifications@github.com

wrote:

I'm using Sublime Text 2 and the Nettuts Fetch plugin which can fetch
resources via a URL, at the moment trying to get the latest version of
Modernizr proves difficult as there doesn't seem to be a single URL that
would auto server the 'latest' version of this script…

Currently I'm querying the url: "
http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.1/modernizr.min.js"directly but the moment
2.6.2 comes out I will still be referencing 2.6.1.

Is there a better way to grab the "latest" of a given library?

Something like: "
http://cdnjs.cloudflare.com/ajax/libs/modernizr/latest/modernizr.min.js"where the latest folder would always contain the most up to date version of
that lib would be nice.

Any thoughts on this or a better way for me to do what I'd like to do here?

Thanks for reading.


Reply to this email directly or view it on GitHubhttps://github.com/cdnjs/cdnjs/issues/423.

@jannisg

This comment has been minimized.

Show comment
Hide comment
@jannisg

jannisg Sep 12, 2012

Thanks for the reply Thomas.

I've installed the cdnjs package but noticed that it only adds a script tag with the properly set src attribute to the chosen library file.

While this is nice, I would like to access the contents of said script so that I can quickly dump the entire script (not just a link/reference to the script) into a local file.

Look forward to your reply.

jannisg commented Sep 12, 2012

Thanks for the reply Thomas.

I've installed the cdnjs package but noticed that it only adds a script tag with the properly set src attribute to the chosen library file.

While this is nice, I would like to access the contents of said script so that I can quickly dump the entire script (not just a link/reference to the script) into a local file.

Look forward to your reply.

@pwnall

This comment has been minimized.

Show comment
Hide comment
@pwnall

pwnall Sep 13, 2012

Contributor

I think this would be very useful. latest might be asking for trouble though. How about supporting URLs like

  • /ajax/libs/library_name/2.6.x - latest 2.6
  • /ajax/libs/library_name/2.x.x - latest 2.x
  • /ajax/libs/library_name/x.x.x - latest

For libraries that use semver, this should work pretty well.

Contributor

pwnall commented Sep 13, 2012

I think this would be very useful. latest might be asking for trouble though. How about supporting URLs like

  • /ajax/libs/library_name/2.6.x - latest 2.6
  • /ajax/libs/library_name/2.x.x - latest 2.x
  • /ajax/libs/library_name/x.x.x - latest

For libraries that use semver, this should work pretty well.

@jannisg

This comment has been minimized.

Show comment
Hide comment
@jannisg

jannisg Sep 13, 2012

The latest was more for explaining my point than suggesting that it was the best solution, @pwnall's does seem much nicer though as it would allow the locking of a major version which could be very handy.

jannisg commented Sep 13, 2012

The latest was more for explaining my point than suggesting that it was the best solution, @pwnall's does seem much nicer though as it would allow the locking of a major version which could be very handy.

@ryankirkman

This comment has been minimized.

Show comment
Hide comment
@jannisg

This comment has been minimized.

Show comment
Hide comment
@jannisg

jannisg Sep 13, 2012

That would be my preferred url syntax too.

Thanks @ryankirkman for looking into this.

jannisg commented Sep 13, 2012

That would be my preferred url syntax too.

Thanks @ryankirkman for looking into this.

@thomasdavis

This comment has been minimized.

Show comment
Hide comment
@thomasdavis

thomasdavis Oct 7, 2012

Member

@jannisg @ryankirkman because we are running a server for the stats now, we could throw an API on there that could handle this situation.

Would add network request so wouldn't be fantastic for serving files on website.

Or we could throw into the build process a script that copies the latest version into a latest.js file next to package.json...

Member

thomasdavis commented Oct 7, 2012

@jannisg @ryankirkman because we are running a server for the stats now, we could throw an API on there that could handle this situation.

Would add network request so wouldn't be fantastic for serving files on website.

Or we could throw into the build process a script that copies the latest version into a latest.js file next to package.json...

@thomasdavis

This comment has been minimized.

Show comment
Hide comment
@thomasdavis

thomasdavis Oct 17, 2012

Member

Closing this issue for more information visit #360

Member

thomasdavis commented Oct 17, 2012

Closing this issue for more information visit #360

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment