ThomasTJdev / nim_websitecreator

Nim fullstack website framework - deploy a website within minutes
https://nimwc.org
MIT License
176 stars 7 forks source link

Code formatting in blogs can result in error due to loading order of prism.*.js #40

Closed ThomasTJdev closed 5 years ago

ThomasTJdev commented 5 years ago

We are loading prism code highlighting if the class `prismOn´ is present. (This is not documented anywhere. It happens automatic if you use the custom Summernote's insert code button) Ref.: #38

The prism files are loaded in js.js. The files are inserted in the correct order, but they are not using defer. This can result in the syntax files are loaded before the main file.

https://github.com/ThomasTJdev/nim_websitecreator/blob/master/public/js/js.js#L66-L81

ThomasTJdev commented 5 years ago

1) Defer tag inserted 2) Manually activation 3) Delay before activating. This has 2 purposes. I would prefer another approach - ideas? 3a) To ensure the libraries are loaded 3b) Large code snippets can take multiple seconds to format, which can cause a deadlock on mobil devices. Now the page is fully loaded.

1b3a221403cb6dcfcbe9c6f2b7b5bd5a07be5696