Live CockpitCMS+Svelte Projects:
- (Out of control) DOM loads,
bundle.js/cssdownloads and Svelte initializes - Svelte detects browser language (
App->LangDetectModule) - Svelte API call to CockpitCMS (
axios)/cockpit/api/collections/get/Page?lang=.../cockpit/api/singletons/get/SiteSettings?lang=...- meantime
Loading.sveltegraphic
- According to server response, possible errors:
- Page not found (404) -> Relevant error is displayed + navigation (without footer)
- CockpitCMS unreachable (500) -> Relevant error is displayed without navigation and without logo (nowhere to get it from) (without footer)
- Page is empty (
Layout.svelte) -> Simple message is displayed + footer Would be good to style it like the previous two
- If the page loads successfully:
- async
assignContent()according to currentslugvalue fromRouterextracts relevant page from API response - svelte bug in {#await} causes svelte transitions, scrollvideo and possibly other things to duplicate the block, the only possible fix is to move asynchronous logic into <script> and use {#if} github#1591 github#4064 - relevant page is passed to
Layout.svelte, separatelyHeader,Footer, title (Head),Themeproperties are loaded Layout.sveltedistributes information it received among relevant components (sections/*), which process them as needed and render relevant HTML.
- async
Previous: 4. Svelte Files Explainer
Next: 6. Performance, Graphical and Compatibility Issues