Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery file name

This one should be easy, and I think I know the right answer, but here goes.

For compatibility reasons, should I leave the filename of jQuery as "jquery-1.3.2.min.js" or just rename it to jquery.js?

My guess is leave it as is to avoid conflicts in case another app uses a different version of jQuery. If they've renamed it to "jquery.js" and I do the same, I see potential version conflicts.

Am I wrong or way off base?

Jeff

like image 402
Jeff Avatar asked Jul 03 '26 09:07

Jeff


2 Answers

It's a very good idea to have version-numbered JS (and CSS) files, because that lets you configure your web server to use a far-future Expires header on such files without running into caching problems. When the file gets updated, it gets a new version number, so the browser always fetches the new version, not the old cached one.

You should do this on your other JS and CSS files, too. You want this to be automated, not something you manage by hand. Your development work happens on unversioned files, and your versioning system creates versioned copies and works out the details of updating the references to the CSS and JS files in the HTML files to point to the versioned copies. This can be a bit of work, but well worth it when it comes to speeding up your site. It took me about a day to set my system up. The improvement wasn't subtle.

like image 67
Warren Young Avatar answered Jul 04 '26 23:07

Warren Young


I would go with jquery-1.3.2.min.js because it's more specific and you can immediately tell if you're reviewing this site in months to come, as well as avoiding any filename confliction in the future.

You shouldn't have any issues with updating, if you're relying on something like an include/template file for the javascript.

like image 35
meder omuraliev Avatar answered Jul 04 '26 21:07

meder omuraliev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!