Closed whereismyjetpack closed 7 months ago
@chrisdarke42
All JS to be used on the site needs to be routed through the libraries.yaml For that purpose it is best to have a 'base' js file (scripts.js or similar name) that is applied to the base theme globally. This is currently being accomplished with 'psulib_base.global.js'. Another JS file could be added in as another library entry, eg:
link_hover_widget: version: VERSION js: js/link_hover_2.js: {}
Libraries are what also help deal with caching: https://chromatichq.com/insights/drupal-libraries-version/#:~:text=Library%20Version%20%26%20Caching,could%20not%20be%20more%20important.
You can also aggregate some files in a dir together such as :
mix.combine('path/to/dir', 'all-files.js');
so you could have a dir like /js/base and have all of that dir be converted into base.js
ok, great. I'll try to come up with a pattern that mimics this, and we can test from there. thanks!
I'm not sure how to proceed, but I'm going to start the conversation
I presume we would want something like
in the webpack.mix.js file and then put our javavascripts in
src/application.js
? add this to our libraries file?https://laravel-mix.com/docs/6.0/mixjs