In our current setup, we server-side render multiple pages (1 for main landing-page, 2 for nav, 1 for footer), and then combine them to generate our final page. When server side rendered, it looks like each of these pages have 34k of CSS that is identical. Can we safely strip this from each asset and include once on the page?
• Is there a way for us to explicitly identify in the server-side rendered HTML for a page what parts are common/shared?
I believe the shared parts depend on the current project, as they contain font info, etc., but is it safe to assume that if all pages come from the same project, a certain part of code is always shared between pages?
@tiago we are server-side rendering each page to generate HTML, and then injecting the HTML into the final page for each of them
The reason is as follows:
• Our site is on shopify, and most of the pages are still shopify pages… For shopify pages, the main content on the page comes from shopify, but we still want Nav / footer / etc. to come from plasmic. To do this, we pre-render nav / footer / etc. server side, then inject the final HTML into the shopify pages in the right place
• Some pages use plasmic for the site content, but to keep things clean / the-same, we also there inject nav / footer in the same way as above
Hmmm, I see! You can pass multiple arguments to maybeFetchComponentData and if you fetch multiple components at once it should not generate duplicate code/CSS. Something like:
@tiago how would you change this if /header, /nav and /footer needed to be rendered to different react roots? (we are also pre-rendering via SSR separately…)