Sharing JS files across multiple Apps (for local and production)
<p>Say I have the following structure for 3 different apps that live on 3 different domains, and a personal "cdn" where I can put files that are common across all three apps:</p>

<pre><code>root/
     /dinosaureggs.com
     /magicalapples.com
     /wizardsupplies.com
     /mypersonalcdn.com
          /js
          /php
          /css
</code></pre>

<p>This same structure is mirrored on a local and production environment.</p>

<p>If I'm in dinosaureggs.com and I want to use a shared PHP library in the /php folder I can say:</p>

<pre><code>require('/../mypersonalcdn.com/php/library.php')
</code></pre>

<p>This works fine on both the local and production servers.</p>

<p>However, it won't work for JS because JS includes can't back out of the "app" with paths the same way PHP can.</p>

<p>I can't say:</p>

<pre><code>&lt;script type="text/javascript" src="/../mypersonal.cdn/js/library.js"&gt;&lt;/script&gt;
</code></pre>

<p>Now, on live I could say:</p>

<pre><code>&lt;script type="text/javascript" src="http://mypersonalcdn.com/js/menus.js"&gt;&lt;/script&gt;
</code></pre>

<p>But this doesn't solve my problem for local environment (at least to the extent that I wish to leave it truly locally and have the option to develop offline).</p>

<p>Any suggestions?</p>
