I have a wordpress site that loads a single app.js file filled with jQuery that handles functionality for the entire site. It is incredibly long and difficult to navigate. I would like to switch over to something like a SCSS partials approach, where I can create separate files for reusable code or single pages, and then load those files into one single app.js file.
I know that jQuery has a $.getScript() function, but my understanding is that I cannot use this while developing on my localhost, and that trying to load files stored locally will not work because of the nature of the $.getScript() AJAX request.
Are there other options that would allow me to create smaller snippets of js, and then import them into a single parent file? I would prefer not to load 25 separate scripts in my <head> for each reusable bit of js I write.
|--js
| |-- app.js
| |-- partials
| | |-- partialOne.js
| | |-- partialTwo.js