Closed jthegedus closed 5 years ago
https://github.com/leptosia/docute/commit/1b02d0f063db00bc357542b5c0bb7d0dd70cfc5c
this commit adds pre-render support, kinda like the way Vue SSR works:
/(Prerender|jsdom|PhantomJS)/i
, it will inject initial state as <script>window.__DOCUTE_INITIAL_STATE__ = {...state}</script>
to the document.window.__DOCUTE_INITIAL_STATE__
instead of fetching file if possible.you need to re-install presite
since I updated the user agent there.
the generated html is kinda large tho, something needs to be done to reduce the size.
@egoist cheers, I'll give it a go.
Thanks for your work on this. It fixes the re-fetching :tada: so I will close this issue.
But I do wish to flag that I still see a flash of the content-loading animation sometimes when changing routes. I'm unsure what the cause is other than the router always displaying this while checking the cache for data.
Using
presite
to create static html of a Docute site is great, except I have found that each route haswhich means that when the HTML finishes loading, Docute will re-fetch the
.md
for the particular route and re-mount it to thetarget: "#docute"
div.This creates two issues:
I'm not sure where a flag would go to stop this from occurring, but an option like so would be nice:
I've tried removing the
new Docute
script from thepresite
output HTML, but this causes the issues with dynamic features like toggling light/dark theme.Related: #34, #174