You can use a special template to externalise TiddlyWiki's core code into a separate file. This configuration allows the browser to cache the core for improved efficiency.
However, there is some inefficiency in this arrangement because the core code is repeatedly loaded and saved every time the content of the wiki is saved. This inefficiency is partially ameliorated when working in the client server configuration because once the wiki is loaded by the browser the synchronisation process only transmits individual tiddlers back and forth to the server.
The remaining inefficiency when working in the client server configuration is that the single page wiki that is initially loaded will contain a copy of the entire core code of TiddlyWiki, making it impossible for the browser to cache it.
The mechanism is activated by setting the root-tiddler parameter to
tiddlywiki YOUR_WIKI_FOLDER --listen 'root-tiddler=$:/core/save/all-external-js' use-browser-cache=yes
Initializing a new wiki
The provided edition
tiddlywiki ./myNewWiki --init server-external-js tiddlywiki ./myNewWiki --build listen
The above commands perform the following:
Saving your snapshots
If you start your TiddlyWiki server in the "external-js" configuration, snapshots you save from the wiki will also have the external-js configuration.
The "server-external-js" edition lets you save the snapshot from the command line:
tiddlywiki YOUR_WIKI_FOLDER --build index
tiddlywikicore-5.x.x.js will be saved in your wiki folder's
Obtaining the TiddlyWiki core in the browser
Obtaining the TiddlyWiki core with Node.js
tiddlywikicore-5.x.x.js will be saved in the
output directory of your wiki folder:
tiddlywiki YOUR_WIKI_FOLDER \ --render '$:/core/templates/tiddlywiki5.js' \ '[[tiddlywikicore-]addsuffix<version>addsuffix[.js]]' \ 'text/plain'
The "server-external-js" edition has a shortcut for the BuildCommand to do the same thing:
tiddlywiki YOUR_WIKI_FOLDER --build tiddlywikicore
Upgrading your standalone wiki
- Proceed with the Upgrade Process for Standalone TiddlyWikis. Your wiki will be converted to a full standalone HTML.
- Open your upgraded wiki in the browser. If you'd like to revert to using the regular template, restore the original shadow tiddler
$:/config/SaveWikiButton/Templateby deleting any custom copy. Save your wiki and you are done.
- Otherwise, from your wiki, select the Tools tab from the sidebar and click on the export tiddlywiki core button to obtain the core from your wiki.
- Verify that
$:/core/save/offline-external-js. Modify if necessary.
- Save your wiki again. Your wiki is now converted to using the external core.