Thanks for the question, it has cropped up before but it hasn’t really had much discussion.
Firstly, it is eminently possible to structure TW5 as an HTML file containing the tiddler store area that includes a JavaScript file containing the code; it’s just a matter of rearranging some of the existing templates. I’ve made a very quick lash-up to demonstrate how it can be done in this branch:
The changes from the master branch can be seen here:
To try it out, download the branch and then on the command line execute:
tiddlywiki.js editions/
tw5.com --build external-js
index.html - 3,889,031bytes
tiddlywiki.js - 1,878,319 bytes
(Compared to the standalone.html size of 4,844,364 bytes)
TiddlyWiki is functional in this arrangement, even with the default download saver, as long as you make sure that the tiddlywiki.js file is in the same folder as the index.html file. It’s currently configured so that clicking the ‘save changes’ button will save just the HTML portion of the split format. We could also make it switchable between the self contained vs. split format, and we could add a button to download the tiddlywiki.js file.
Now, there are some undeniable advantages to this arrangement:
* The HTML file is smaller
* Browsers can cache the tiddlywiki.js file, improving online performance
* Lots of TiddlyWikis can share the same tiddlywiki.js file, saving a couple of megabytes each time
* One could upgrade all the TW HTML files in a directory just by updating the tiddlywiki.js file
But I wouldn’t be inclined to adopt this arrangement as the default because it also introduces a bunch of significant problems that stem from the fact that the TiddlyWiki file is no longer self contained:
* Users need to remember to copy the tiddlywiki.js file around with it as well, adding to the cognitive load of using TiddlyWiki
* The documentation for getting started (which is already pretty hair-raising) would get significantly more complex
Nonetheless, I’m interested to see people experiment with the idea, and learn more about the pros and cons. If there’s any interest I might restructure this branch as a plugin, and add some user interface bits.
Another thought that occurs to be is that this mechanism could be used to share tiddlers between several wikis: it’s possible to pack arbitrary tiddlers into the tiddlywiki.js file.
Best wishes
Jeremy.