I'm trying to build a plugin and enqueue my scripts to footer. For performance reasons I'd like to load this plugin scripts after the functions.php scripts, because furthermore it will break the page otherwise.
I mean that in my functions.php there are essentials scripts like:
which are loaded in the header. Next I have other essentials scripts, always in my functions.php, that are loaded in footer like:
etc... The problem is that when I load the plugin scriptS in footer they load just before the others in functions.php like:
HERE PLUGIN SCRIPTS
- jquery-migrate (from functions.php)
- hoverintent (from functions.php)
This makes the website break because some of the plugin scripts depends by the others loaded next. I guess it's a priority problem but I don't know how to handle that. I'm using the right hook for this according to codex:
wp_enqueue_script('typeahead bundle', 'https://cdnjs.cloudflare.com/ajax/libs/typeahead.js/0.10.4/dist/typeahead.bundle.min.js', array('jquery', 'hoverintent') , false, true);
Even setting the array with dependencies it won't work. What am I doing wrong? Thanks.