-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Render navbar at compile time using a template #1054
Comments
I've experimented with the vue prerendering part here: https://github.com/openorclose/markbind/tree/prerender It only prerenders on So you do The styles are there just fine: But the problem is that we are unable to put vue back in after prerendering. What prerendering allows you to do is: (e.g. When you build the files, a headless browser will run the Vue and convert the tooltip into However, to make this html file interactive, you still need the original vue code This means that we would need to double the size of our served HTML, since we would serve the prerendered data AND the original unrendered data. |
A potential direction we could explore: Try to make as many vue-strap components as we can "static" (like Then we can try to find a way to only prerender these components and reduce FOUC this way. An even more drastic alternative (but would probably solve FOUC altogether) would be to remove our dependency on Vue altogether and do it old-style, manually generating the HTML and adding in event listeners after page load. |
After server rendering it, the client takes over the html and does client side hydration.
The server would send a modified vue bundle to the client that contains the "initial state" of the application.
We could test out how effective functional components are as an alternative after MarkBind/vue-strap#130 and #981, which also improves performance for stateless components. |
Yup, this modified vue bundle would be the one containing the original vue source for normal uses. The point is, Vue can't just look at the prerendered HTML and know what to do. A lot of information is lost such as event handlers and other data not inside the HTML. For example, the prerendered tooltip would look like <span><span style="border-bottom: 1px dashed;">tooltip</span></span> The rendered HTML doesn't contain the content of the tooltip at all. |
Yup, agreed with this |
One of the main upsides of SSR is exactly to defer the costs of client side rendering with front end frameworks, while keeping the full feature set of such frameworks, which is essential for how most websites are single page applications nowadays. The downside in a typical backend would be a delay in server response time as the server has to render the page, but depending on the use case, it may lead to a faster TTI for the client, especially on mobile devices with not as much computing power. From the vue docs:
|
Removed the mobile view navigation part of the issue ( duplicate of #980 ) |
Opinions needed @acjh @marvinchin I'm thinking of attempting #980 at the same time as well, effectively "stuffing" the site-nav into the navbar, but with mobile view formatting. |
closing in favour of SSR first. We can reconsider if even with SSR fouc is still noticeable. |
Is your request related to a problem?
The most visible sign of FOUC is the flashing navbar, even with the temporary styles applied to them.
Describe the solution you'd like
We could remove the navbar component from vue-strap and instead adapt the template over to /markbind and render it at compile time.
temporaryStyle
implementations, which should result in a cleaner codebaseDescribe alternatives you've considered
1)Introduce more specific ( to the color of the nav bar ) temporary styles. While it is a good temporary fix, it cannot eliminate FOUC completely as there is still reliance on vue-strap to render the dom structure of the navbar
2)Explore introducing vue SSR to this project to eliminate FOUC for every page after vue-strap is moved over. Problems:
markbind serve
and only have it active duringmarkbind build
Additional context
na
The text was updated successfully, but these errors were encountered: