Draft: [REF,FIX] Refactor headerlib to allow ajax append and proper minimization and cache busting
Problems to solve:
- Tiki doesn't have an organised way to add additional js and css to an already loaded page. This is already happening in a number of cases (previewing wikiplugins, tracker table editor, etc.). It will happen constantly as we transition more and more parts of tiki to a Single Page Application. Currently there is a number of hacks with different shortcomings and bugs.
- There are multiple cache implementations in tiki. Several of them try to cache parts of headerlib, in different ways (and with different bugs)
- The js runtime minimization/bundling/cdn handling code is not well isolated. This makes it very hard to make it reliable, optimize, and detect if single single script continuously causes cache misses
- There are absolutely no unit tests for one of the most core and potentially fragile parts of tiki
-
Make the properties of headerlib private -
Add at least unit tests for basic functionnality (ordering, duplicate detection) -
Add snapshot support, and getting a diff since last snapshot. Mostly to support the ajax additional js/css required use cases, and the caches use cases -
Make the hashes of the js added available to javascript -
Isolate the minimization code -
Figure out a way to exclude the hashes already present in the js of the page from the current snaphot -
Make a clean API for all the above -
Finish !4534 (closed) -
Finish !4439 -
Finish restoring caches -
Basic review of CDN handling, like !4570 (comment 1796405777) -
Likely load !4147 (merged) from the controller to avoid processing a 3mb js file anytime the feature is enabled
Problems that won't be solved now but will be considerably easier to solve:
- Complete cache busting in production after a tiki update.
There is much progress being made, but still days of work...
Edited by Benoit Grégoire