Menu Close

Moving from bleeding edge to local cache

A year ago, I was contracted to move a website that had no business being on the open web to an internal website.  They were in no rush to get it.  I was starting a new job. It took me several months to complete.

I finished and delivered it in December, and for 5 months they were happy. Last week, I got an email telling me it had stopped working.

I took a look Saturday morning and inside the offending .php file I found 

<script src="https://code.jquery.com/ui/jquery-ui-git.js"></script>

It took me a while to realize, it’s referring to the absolute bleeding edge version of jquery-ui.   I could run a script to update every php file.

for f in $(grep query-ui-git -rl) ; do sed -i 's,jquery-ui-git,1.11.3/jquery-ui.min,' $f; done

And my script worked and my local copy of the website worked.

A question arises.  “Why did the original developer use the bleeding edge version of jquery-ui?”

I could find the developer; but unless she happens to remember, I’ll never know.

Another question: “Does it make sense to use an external javascript file?”  This site is running on the user’s local machine. Referencing the online version of jquery-ui doesn’t make sense.

I’ll have to download js file into the local machine and run my bash again, and this time to point it locally.  

wget https://code.jquery.com/ui/1.11.3/jquery-ui.min.js

for f in $(grep 1.11.3/jquery-ui.min -rl) ; do sed -i 's,https://code.jquery.com/ui/1.11.3/,/,' $f; done

I think there’s probably a script that already does that for me.