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

[Draft/WIP] test: PoC SSG #17

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

[Draft/WIP] test: PoC SSG #17

wants to merge 1 commit into from

Conversation

willwill96
Copy link
Collaborator

Very much a WIP - would need a lot of work to integrate with existing keycloakify features (particularly anything that accesses window.kcContext)

These changes would allow for SSG of the individual .ftl files, potentially decreasing FCP/LCP web vital metrics and allowing for more customizable html on a per-page basis.

The overview of how this works is:

  1. Replaces the vite build with vike (previously vite-plugin-ssr)
  2. Uses Vike's SSG support to pre-render the login.ftl page
  3. As part of SSG, uniquely identifiable values are injected into the page contents (username - Kc_Context_Username / submitUrl - Kc_Context_SubmitUrl)
  4. After the vite build, replace all of those usages in the html with the ftl equivalent. For example Kc_Context_Username gets translated to ${(login.username!'')}. Additionally moves the vike-created assets to be consistent with how keycloakify works.
  5. Uses existing keycloakify cli for the rest

Note: At the moment, this PoC is not fully functional. This example includes enough to:

  1. Load the login page
  2. Submit the login page - There is no password field so you will get an error
  3. When the login page reloads, you should be able to see that the initial html includes the email previously entered.

@willwill96 willwill96 marked this pull request as draft March 16, 2024 22:22
@garronej
Copy link
Collaborator

Damn sorry @willwill96,
This is very interesting.
Just now am I looking at this because for some reason I have the notification disabled for this repo.

@garronej
Copy link
Collaborator

This would be fantastic to have.
What's you though on this now is it feasable? I'd love to schedule a call with you to discuss your finding on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants