{"id":7106,"date":"2020-10-28T10:19:36","date_gmt":"2020-10-28T15:19:36","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=7106"},"modified":"2020-10-28T15:39:12","modified_gmt":"2020-10-28T20:39:12","slug":"updating-jquery","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=7106","title":{"rendered":"Updating JQuery"},"content":{"rendered":"\n<p>We&#8217;ve got to upgrade some Javascript modules at work &#8212; JQuery, Bootstrap, etc. Problem is that changes between the versions mean there&#8217;s a lot of rewriting required before we can update. And we pull in these modules using a shared header file. While we <em>could<\/em> stage all of the changes and update the entire website at once &#8230; that means we&#8217;re all dedicated to updating our components &amp; are delaying the update until we&#8217;re finished. <\/p>\n\n\n\n<p>That&#8217;s not ideal &#8212; and has the potential to break a lot of things at once. I plan, instead, of putting a default version in the shared header file. And some mechanism to source in a newer version by setting a variable in the individual tool&#8217;s PHP code <em>before<\/em> the header is pulled in. So each tool within the site has a $strJQueryRev, $strBootstrapRev, etc variable. Then the shared header file looks for that variable &#8212; loads a newer version when requested or loads the currently used older version when no version is indicated. <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nif($strJQueryRev == &quot;3.5.1&quot;){\n echo &quot;&lt;script src=\\&quot;https:\/\/code.jquery.com\/jquery-3.5.1.min.js\\&quot;&gt;\\n&quot;;   \n}\nelseif($strJQueryRev == &quot;3.1.1&quot;){\n echo &quot;&lt;script src=\\&quot;https:\/\/code.jquery.com\/jquery-3.1.1.min.js\\&quot;&gt;\\n&quot;;   \n}\nelse{\n echo &quot;&lt;script src=\\&quot;https:\/\/code.jquery.com\/jquery-2.2.4.min.js\\&quot;&gt;\\n&quot;;        # Old, in use, version is default\n}\n<\/pre><\/div>\n\n\n<p>Or even<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\nif(!$strRevisionNumber){$strRevisionNumber=&quot;2.2.4&quot;;}\necho &quot;&lt;script src=\\&quot;https:\/\/code.jquery.com\/jquery-$strRevisionNumber.min.js\\&quot;&gt;\n<\/pre><\/div>\n\n\n<p>Each developer can add a version number to a single tool, test it, push it up through production using the newest modules. Move on to the next tool. The site still isn&#8217;t done until we&#8217;re all done, but we can slowly roll out the update as people are able to test their tools. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve got to upgrade some Javascript modules at work &#8212; JQuery, Bootstrap, etc. Problem is that changes between the versions mean there&#8217;s a lot of rewriting required before we can update. And we pull in these modules using a shared header file. While we could stage all of the changes and update the entire website &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[856,854,35],"class_list":["post-7106","post","type-post","status-publish","format-standard","hentry","category-coding","tag-javascript","tag-jquery","tag-php"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/7106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7106"}],"version-history":[{"count":1,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/7106\/revisions"}],"predecessor-version":[{"id":7107,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/7106\/revisions\/7107"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}