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?
+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.
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. :)
+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.
And boy have things changed since I posted in this thread. I now use SASS and have one (sometimes a few max) CSS files now instead of a dozen lol. Even this old fart learns new tricks
Personally I still use multiple css/sass files and just let them get compiled into one file on export. I find it a lot easier for development, eg. I know the styes for a hero div are located in hero.css, no need to scroll through a long file looking for the correct class.
Ewww I would never do that either lol. I use one main css file that at least a dozen or 2 sass files are forwarded to so I can still work organized and on export or publish the sass files are all combined to one file. Works pretty slick for me so far. BSS just really makes it easy since it has a built in compiler for them.
BSS really does makes everything easy, I was talking to a local competitor a few evenings ago, he was saying how he hates doing website, with all the responsive testing etc. I was tempted to tell him about BSS, but, well, he is the competition. I can’t give all my secrets away