0

I read somewhere recently that "using jQuery-latest is considered harmful."

This discussion deals with the question, too:

Is there a link to the "latest" jQuery library on Google APIs?

So I'm wary about using that ("latest"), but what is the preferred way of dealing with new versions? "Latest" would seem like a no-brainer except for the downside of the libraries not being cached (performance drag). Of course, there's also the consideration that you would want to test your code against the new libraries rather than just blindly/automatically upgrade.

SO...when you do want to upgrade the jQuery version used (as well as jQuery-*, such as jQueryUI), how do you go about this in a no-tedious way? For example, if you have 42 sites that you want to upgrade from version 1.9.2 to version 2.0.0, do you hand edit 42 files, or is there some tool that will do this for you? Obviously, you can write a script, depending on which technology you're using, to do this for you, but I'm thinking there must be a common way to approach/solve this chore, as it's something that is done by millions of developers every time a new version of jQuery is released.

Community
  • 1
  • 1
B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862

2 Answers2

1

You can include a file from your server using server-side includes, that defines all of your dependencies - jQuery, Modernizr, whatever else. This assumes that all of your sites have server-side code and use similar libraries. This would let you change it once, and have it appear in all 42 sites.

1

Obviously, you can write a script, depending on which technology you're using, to do this for you.

This is true, but since you don't provide us with enough information, I can't provide a script to you.

Probably the best way to do this is by linking all sites to just one page with the jQuery code (for example, yourwebsite.com/jquery.js). This way, all you need to do is update that single jquery.js on one site and they're all updated.

As for updating them in the present, you'll probably need to do it by hand or script.

RandomDuck.NET
  • 490
  • 5
  • 17