I am new here and I am new to sage. I have many years of experience with wordpress plugins and theming, but not a lot with “modern web development standards”. I worked a bit with lavarel lumen before, and when I got into a new wordpress theme project I found Sage 10 and wanted to give it a shot. I like it a lot, but I still got to learn the ropes of how this works.
I have researched a bit on this but didn’t find a solution, so I post it into this board… feel free to point me to an answer if one exists already
So I ran into the issue where I have another plugin that requires bootstrap without loading it by itself, but lists it in its dependencies.
*wp_register_script( 'daterangepicker', plugins_url( 'js/daterangepicker.js', __FILE__ ), array( 'jquery', 'bootstrap', 'moment' ), '3.1', true );*
The old theme has bootstrap registered and enqueued via wp_register_script(‘bootstrap’…), so the plugin picks it up and all works fine.
The problem is, that as I understood, Sage registers one single vendors.js file in the setup.php:
*wp_enqueue_script('sage/vendor.js', asset('scripts/vendor.js')->uri(), ['jquery'], null, true);*
And then it imports bootstrap in the app.js:
* import 'jquery'; import 'bootstrap';*
But the external plugin doesn’t pick that up, so it won’t enqueue its own script.
For a test i just changed the script name in the setup, this seems to work:
*wp_enqueue_script('bootstrap', asset('scripts/vendor.js')->uri(), ['jquery'], null, true);*
But I guess this is not a sustainable solution, also ideally since I wanna use more external scripts, I want to understand if there is a way to register the scripts, but then still load them in the vendor.js to minify them
or would it be smarter to go the other way around and enqueue all these scripts seperately and add them to the mix configuration to minify them on production?