There are some services (such as FB or AddThis) that provide a piece of code. He looks like
<div class="service-name" data-something="x"></div> <script type="text/javascript" src="http://service-domain.com/service-name.js"></script>
OK, cool, so usually you embed it in your HTML and it works. Not with the Meteor.
Here is what I see:
<script> inside the template / body does not load - I do not see it in resources, something in Meteor actually does not allow the browser to recognize it as a JS file- powered by
<head>
Now here are the problems and questions:
- I donβt want to load it from
<head> - because of speed - Even if I download it from there, we have QA and PROD environments. They should download this script from different domains (for example, service-domain-qa.com vs. service-domain.com).
And surprisingly, it cannot use helpers / template variables in <head> .
With traditional frameworks, this is not a question - you can include scripts anywhere, and they just load; You can use logic / variables in any part of your server templates.
So how do I do this in Meteor? Let me repeat:
- I need external scripts (hosted on a third-party domain) to be uploaded to my application page.
- Saving this script in my project folder is not an option
- The script path depends on the environment (we already have a settings system), so the place of the template that displays it must be transferred with some data from the code
I know a way to achieve this with dynamically loading a script from my code (using LAB.js or something else) to Template.created, but this is too much ...
javascript meteor
Guard Jan 17 '13 at 23:02 2013-01-17 23:02
source share