4 ms·
Love the creativity! Not only storing the data directly in the file, but also the clever hackery to make a single file that renders a page in the browser yet ca
by EvanDotPro 5y ago
Love the creativity! Not only storing the data directly in the file, but also the clever hackery to make a single file that renders a page in the browser yet can also be executed in the terminal with Node. Very cool!
- ollipal 5y agoThanks a lot! The hardest part was to figure out how to get source code access through js from the browser without browser's own modifications. It seems that all browsers process 'document.documentElement.innerHTML' in different ways... That is not good if you want to have this file in version control for example. In the end the solution was to put as much as possible between <script> tags, including html + css, and then it can all be accessed perfectly with 'document.currentScript.innerHTML'. Then I just hard coded the two lines that could not be put inside the tags. All this just to ensure that the updating does not affect the source code in any way :D