How are you including your JS which binds select2 to the select boxes? Just adding via grunt?
I’m wondering if adding everything to
scripts.js is inefficient as I dont need select2 on every page.
You should be able to do a quick size comparison with and without select2. Personally I tend to add most scripts to Grunt but it’s up to you.
But if select2 is in
scripts.js then anything else I add needs to be included afterwards which doesn’t fit in with the “gravity forms way” (and probably lots of other plugins)
I’m not clear on what you mean by anything else I add needs to be included afterwards. What is the “anything else” you’re referring to?
jsFileList gets concatenated and uglified in the order of that array so just ensure you add select2 before the final array element which contains your custom scripts.
FWIW: I routinely add
add_filter('gform_init_scripts_footer', '__return_true'); to my projects that use Gravity Forms. The current beta is a little problematic with the new placeholder scripts but overall GF tends to behave reasonably well.