How to organize my js files

I’m working on a multisite instalation, that will have several subsites and i’m in doubt about how to organize my js files.

The WP Theme Handbook

says that js files should go inside the assets folder.

So as each subsite will have different js scripts, i assume its correct to make a .js file for each site.

My question is if its a good idea to make multiple js files per site, since there are some scripts that will run only on specific custom templates. I ask this because if i did this many of my js files would have only one function inside.

The file structure would be something like this:

Root
-assets
–js
—site1js
—-script1.js
—-script2.js
—-script3.js

—site2js
—-scripts.js

Does this affect the performance of the site? Or its just a bad pratice and i should put all the scripts together?

Also, does it apply to css as well?

Thanks

Read more here:: How to organize my js files

Leave a Reply

Your email address will not be published. Required fields are marked *