!!! This is just a draft for discussion !!!
In doing this, it greatly reduces the size of the HTML (around ~50KB depending on site, before gzip) and reduces the number of necessary
JSON.parse on the browser boot. To work with CSP it adds a nonce to secure the inline script, keeping this payload inline with the main document.
On the Ruby side, we are still generating/storing JSONs everywhere, so this PR hacks around by doing parsing each part back into a Hash so it can create a proper JSON only in the last step. If this approach is deemed worth to follow up we will need to fix this by adding Hash versions of each method so we don’t do double the work on the backend.
I would like the review on this refactor to see if it is something worth pursuing.
One unexpected change from this PR is that it fix the “View Source” breaking on Firefox . I believe the 350KB single HTML tag highlight was the culprit.