Yes I’m familiar with everything regarding script loading in WP. I’ve also read this and I understand the reasoning why Give and plugins in general handle things in a certain way.
The way I’m using WP is as a framework + CMS. Frontend is completely customized. Dependencies (plugins) are handled with Composer, Bower for frontent libs, and Grunt for building (including script concatenation and minification) and deploying. For more details take a look at this repo Github.
Give, like a lot of other “frontend” plugins, relies on library code. WP libraries like jQuery
can be dequeued but plugins’ libs e.g. $.qtip
which is bundled with Give can’t be in case I already have it included in my concatenated build file. It would be possible to just dequeue everything Give loads by using the provided hook but then looking up the entire script dependency chain, hooking it up into my concat task and also handle script translation would just be too much of a hassle and feel hackish.
So for me as a developer the perfect solution for plugins loading JS/CSS on frontend would be a config option to disable all library code dependencies and only load application code. In case this config option is enabled the plugin would only register (wp_register_script
) and localize (wp_localize_script
) it’s application script but not enqueue it (wp_enqueue_script
). Enqueuing would be left up to the developers in their script enqueuing function so that they’re able to ensure the order of scripts is correct. You’d have to include a list of frontend dependencies in the documentation so that devs aren’t required to read the source.
If you’d consider this kind of approach let me know and I’ll help.