Loading sitewide Javascript files

Hi, I'm developing a large site (around 300+ pages), most of these pages make use of a javascript file which I have organised in the assets folder.

The problem I have is that every page calls to load up every javascript file. For example, my home page uses a couple of javascript files, but the html calls to load every javascript file used on the whole site - up to 300! which has adverse effect on load times.

I know I could amalgamate all javascript files into one large one, but I'd rather not do this as it's far easier to edit them as single files allocated to single pages - they will get edited on a regular basis.

I guess what I'm asking is, can something be done to only load the javascript files that are used on the current page?

Thanks ion advance

+1 on this and CSS, CDN's etc. as well. We've asked for this for quite some time now, I do hope it's in the works in one of the upcoming updates soon.

Removing them via script, for people like me that don't really know how to use the export script setup, isn't really an option. And obviously removing them after export would be rediculously tedious work after ever export.

Would really be nice if only the files for the page itself were linked and nothing more. I thought I had read something quite a while back on it in a discussion about this very thing that they added it to their list possibly with a checkbox thing or way to select which files to include on each page. Guess we'll see.

How about adding the specific javascript to the page using the custom code component?

That works yes, but it's a work around, and we shouldn't have to do that :)

That's because you really should be loading a single JS/CSS file so that browser caching works the way it was meant too.

Saj saj.bss.design

I can guarantee you that I will probably "never" have a single JS and CSS file, working that way is pretty much impossible and it's much easier to deal with things when you know exactly where to find them. Not to mention that every time I've tried using the feature in BSS that combines them and minimizes etc. it breaks the site completely. I'll stay with what I'm comfortable with, and I definitely shouldn't be penalized for that. :)

I can combine all my javascript files using a batch command line, but I'd rather not.

I have everything structures in folders within the assets folder making it easy to locate which javascript file I need to update regularly.

Surely this could be implemented?

+1 for this if I'm understanding it correctly.

Current problem: All JS files included in a project get loaded on every page. Is that correct?

Feature Request: Specify per page, which JS files to use.

+1, this is definitely something that would be useful to me.

The only issue I can see this creating is the inability to minify all the JavaScript into a single file when exporting. I however don't mind losing this feature, as minifying the individual files should still be better.

As for browser caching, you could also generate a minified file per each page (minding duplicates) to minimize the number of files. I would reasonably assume that they're cached by individual pages anyway, not once for the entire domain.