title: Meteor JS: use external script
body: <p>There are some services (like FB like or AddThis) that provide a snippet of code.
  It looks like</p>
  <pre><code>&lt;div class=&quot;service-name&quot; data-something=&quot;x&quot;&gt;&lt;/div&gt;
  &lt;script type=&quot;text/javascript&quot; src=&quot;http://example.com/service-name.js&quot;&gt;&lt;/script&gt;
  </code></pre>
  <p>OK, cool, so normally you paste it to your HTML and it works. Not with Meteor.</p>
  <p>Here's what I see:</p>
  <ul>
  <li><code>&lt;script&gt;</code> inside of template / body <strong>is not loading</strong> -- I don't see it in Resources, something in Meteor is actually preventing browser from recognizing it as a JS file</li>
  <li>it works from <code>&lt;head&gt;</code></li>
  </ul>
  <p>Now here are the problems and questions:</p>
  <ol>
  <li>I don't want loading it from <code>&lt;head&gt;</code> -- because of the speed</li>
  <li>Even if I load it from there -- we have QA and PROD environments. They <strong>must</strong> load this script from different domains (like <code>service-domain-qa.example</code> vs. <code>example.com</code>)</li>
  </ol>
  <p>And surprisingly you <strong>cannot</strong> use template helpers / variables in the <code>&lt;head&gt;</code>.</p>
  <p>With traditional frameworks it's not a question at all - you can include scripts anywhere and they just load; you can use logic / variables in any part of you <em>server</em> templates.</p>
  <p>So, how should I do this in Meteor?
  Let me repeat:</p>
  <ul>
  <li>I need some external scripts (hosted on 3rd party domain) to be loaded into my app page</li>
  <li>Saving this script into my project's folder is <strong>not an option</strong></li>
  <li>Script path depends on the environment (we already have the settings system), so the place of the template that renders it should be passed some data from the code</li>
  </ul>
  <p>I know the way to achieve this with dynamic script loading from my code (with <code>LAB.js</code> or whatever) on Template.created, but this is so much an overkill...</p>