Is there a way to externalise and cache the plugin's resources?

Hi, all

Wondering if there is a way to externalize and cache plugin resources (js, css, etc.) like external-JavaScript-template does?

Because I find that the size of the text I write is not even bigger than the size brought by the plugin, and since the core can be externalized, can the plugin be too?

Benefit:

  • Browser caching.
  • Combined with a plugin marketplace based on package management like npm can reference resource files from external CDNs.
  • Combined with lazy loading for minimal transfers.

Disadvantage: Impairs the integrity of tiddlywiki.

I know this may be a bit strange and OCD, but still want to discuss a possibility here, for the ultimate.

1 Like

Others understand the technical implementation better than me, but I question if this is even relevant on TiddlyWiki, even if externalised the core javascript, both the Node and single file wikis are actually read into memory and runs from there, unless you implement skinny tiddlers which only load on opening, which I believe is not suitable for plugins. Even once loaded there are various indexed filter operators and more in memory to enhance access to key values see https://tiddlywiki.com/#Performance. Keep in mind the way tiddlywiki works, the way it refreshes according to relevant changes in any tiddler that is visible demands certain functionality to be present.

1 Like

Hi @TW_Tones,

I understand that they all end up loaded into memory, I’m just inconvenienced with the huge, constant and unnecessary load in the transmission process, because I am used to hosting multiple tiddlywiki instances on VPS with node.js instead of using a single file. Fortunately, I seem to have stumbled upon a workaround.

Arlen22/TiddlyWiki5-production

It has the ability to integrate all plugins into one JavaScript file and import it from CDN. The following file was generated by removing the built-in core and importing it from jsDelivr according to its readme:

TiddlyWiki5-without core

It’s not exactly what I thought it would be, but it at least accomplishes one goal, caching the core and plugin code.

Regards,

2 Likes

Hi,
This would be great for the huge plugins, e.g. those who use vis.js like Tiddlymap.
Tiddlymap is really great, but I integrate it rather seldom because of its size. I would love to have a version that loads when I want to work with it.
I know that @abesamma `s the Hopscotch-Tutorialmaker uses this trick. Though the demo is not functioning at the moment I have already seen it working.

1 Like

@JanJo Yeah, many plugins reference ready-made libraries, which are often large and available from CDNs.

It seems that they are just referenced in the <script>.

In fact, there are several problems with doing this.

  1. Many plugins, such as Highlight, reference the library as private rather than exposed to the global, so it won’t work properly with just <script> .
  2. The ability to enable, disable and remove plugins is not controlled by TiddlyWiki.