1
I’m adapting a theme (Bootstrap) with Meteorjs but the theme has more than 15 plugins (jQuery), I can’t just put them in the folder /client
and carry them all at once, tried some things (some in despair):
Place scripts in the template footer with tag
<script>
, but were not loaded or when the template Reload, whether they lose or not carryUsing https://atmospherejs.com/mrt/external-file-loader charging is asynchronous, in this case not feasible, I am carrying dependent Libraries among themselves.
Using https://atmospherejs.com/manuelschoebel/wait-on-lib I have the same problem as item 2, I even managed to make them depend on each other using callbacks but it’s so awful that I refused to post the code.
EDIT
When first loading various application "Undefined is not a Function" go to the console
, but when the Content does the Reload, it works perfectly because the library
already loaded. I also used the mrt:preloader
but it had no effect.
What I need is to load a list of scripts in synchronous order.
Are all these plugins great? Can’t you put some in the same file? Is there one that everyone depends on? So you could have jQuery in the head and the rest in the bottom of the body (async)
– Sergio
Some are, but the problem is that the last script that configures the default operation depends on several previous scripts, there arises the problem: if for example the main.js is loading before jquery-ui.js I will have a problem.
– nerijunior
Consider using the require js., Asynchronous charging with dependency handling.
– bfavaretto
@bfavaretto I will try to use and give some return.
– nerijunior
@bfavaretto Even using requirejs did not work the load issue, the problem is like this: The first time the page is loaded, any plugin returns "Undefined is not a Function" in Reload, as the plugin has already been loaded, works normally.
– nerijunior
@bfavaretto Really the requirejs solved the problem! Thank you.
– nerijunior