Add pre-render contents in fragment #1118
wildfiremedia
started this conversation in
Proposal
Replies: 2 comments
-
You might are onto something, but I suggest being more clear about "pre-render something" because it isn't clear at all from the proposal. Plus, Astro already has the concept of pre-render, so you be extra clear about what you're suggesting |
Beta Was this translation helpful? Give feedback.
0 replies
-
@ematipico I have updated my example. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
Pre-render static content for better performance.
Background & Motivation
Pre-rendering HTML fragments in
.astro
as static content eliminates the need for dynamic rendering.I often write a large number of input field controls, which can increase CPU usage.
Goals
Example
Let's see on my contact form, currently, without flatten/pre-render 100 Astro components on a page, it will incurred more processing on every request.
With
Fragment
component, I think it's a good candidate for rendering once using theis:static
directive:Which will flatten to HTML on the page at the build step, just like a pre-rendered static page, but only for a portion of the content in SSR mode.
This benefits lengthy marketing pages that don’t use static page rendering. If only a small portion of the content is dynamic (Real-time Statistic), developers might still end up using hundreds of Astro components unnecessarily.
Beta Was this translation helpful? Give feedback.
All reactions