Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Word of advice: name your .js file after its versioning (or use ?v=x.y.z in the src), because some updates break older code.

I had to go through all the versions at one point to make my old code work again, because I'd used a remote CDN or something at one point.

Excellent tool otherwise, haven't seen anything better so far.



I disagree: version management of that source is not the job of the JS file but the CDN and/or package manager (npm, jspm, what have you). If the CDN you had been using did not provide a way to version the JS you retrieve from it, I would suggest you look for a better CDN.

I can't say that I've even seen a CDN without versioning support; the closest I've seen is that some READMEs for GitHub packages will suggest the RawGit CDN that reflects the GitHub namespace and point to something like the master branch instead of a version tag. I've sent a PR to correct at least one of those that I had come across, but it's also something to realize that if you are using a CDN like RawGit, check the tag/branch you are using.


Your confusing CDN with something else.

A CDN doesn't do versioning support, it serves files and respect the caching headers it was given.


Sure it's not often considered a part of the definition of a CDN, but version management very much is the duty of a good CDN (even just as a part of cache management to know when to clear/refresh caches).

A CDN built for public usage (ie, that you do not run yourself DIY style, and isn't a corporate internal CDN they don't expect outsiders to reuse) that is built to serve JS (and often CSS, too) will through necessity provide some versioning mechanism. As I said, if you find a CDN that is serving JS files and doesn't have some sort of versioning mechanism or policy in place then you find a better CDN. I think at this point good versions strategies is a requirement for a good CDN.

Take MaxCDN as a good example since it is one of the most common CDNs at this point for JS/CSS (Bootstrap, Font Awesome, Twemoji, ...): all of their URLs have version numbers in their path structure (/bootstrap/3.3.7/...).

RawGit is probably the next most common I see, thanks to it making it very easy for anyone to CDN access a GitHub repo. As I mentioned before: RawGit uses git branches and tags in its folder structure for version management. If you are using a RawGit URL with /master/ in the URL you should switch to a version tag pronto (and that's not RawGit's fault, it's yours for giving it a floating version requirement).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: