Skip to content
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

Prerender document <head> at build time #22

Closed
arctic-hen7 opened this issue Sep 24, 2021 · 2 comments
Closed

Prerender document <head> at build time #22

arctic-hen7 opened this issue Sep 24, 2021 · 2 comments
Assignees
Labels
A-templates Area: templates C-performance Category: performance D-easy Difficulty: easy P-medium Priority: medium S-in-development Status: in development

Comments

@arctic-hen7
Copy link
Member

Is your feature request related to a problem? Please describe.
Currently, Perseus renders the document <head> at runtime only, which, though hardly a huge thing, does mean the server ha to do more.

Describe the solution you'd like
At build time, any templates with compatible strategies should have their <head>s prerendered to a .head.html asset, which can be read by the server and interpolated, meaning the server has to do less work. Notably, the generation function for the <head> is deliberately synchronous, and takes state, but it does render to a string, so it makes sense to prerender it if possible, which might give performance improvements of a few milliseconds. This also makes static exporting significantly easier.

Describe alternatives you've considered
At the moment, there's no way to prerender metadata in Perseus, or (to my knowledge) any other Rust framework.

Additional context
Add any other context or screenshots about the feature request here.

@arctic-hen7 arctic-hen7 added C-performance Category: performance A-templates Area: templates D-easy Difficulty: easy P-medium Priority: medium S-in-development Status: in development labels Sep 24, 2021
@arctic-hen7 arctic-hen7 self-assigned this Sep 24, 2021
@arctic-hen7
Copy link
Member Author

This will be included in the PR for #18, though it does involve breaking changes in terms of function naming, but those functions are internal to Perseus (though technically part of the public interface). Given that we're still in beta, this won't push us to v0.3.0, but I'll note it explicitly in the release notes.

@arctic-hen7
Copy link
Member Author

Okay scratch that, static exporting looks like it's going to add quite a few breaking changes, so this will go in v0.3.0.

arctic-hen7 added a commit that referenced this issue Sep 24, 2021
Also laid foundations for static exporting (still WIP).

Closes #22.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-templates Area: templates C-performance Category: performance D-easy Difficulty: easy P-medium Priority: medium S-in-development Status: in development
Projects
None yet
Development

No branches or pull requests

1 participant