Move inline JS into file not working due to template load order of config localization
What did you expect to happen?
I made my own templates for instantsearch and autocomplete and in the process moved all of the JS into a file instead of injecting it inline. I expected the Algolia config to be available via localization so that I could use it on my JS files.
What happened instead?
The template loader injects the config localization in wp_head instead of through wp_enqueue_scripts so I cannot change the priority order to have the config come before any JS is loaded. I was able to get my results showing by putting my custom JS in the footer and leave the config in the header. The downside to this is the DOM loads the markup as empty containers, then a second later, flashes in the search results. I would think it would be more seamless if the JS files and the config parameter are loaded in the head.
Any idea on how I can get around this problem?
Seems to me like the localization should be using the wp_enqueue_scripts hook instead of wp_head

Technical info
- WordPress version: 4.9.8
- Algolia Search plugin version: 2.11.2