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

First iteration: generate static website from static routes #2

Closed
essenciary opened this issue Oct 7, 2024 · 4 comments
Closed

First iteration: generate static website from static routes #2

essenciary opened this issue Oct 7, 2024 · 4 comments
Assignees

Comments

@essenciary
Copy link
Member

This is the simplest scenario.

[ ] Users add GenieStatic to their app/project
[ ] Then they call GenieStatic.build passing the path where they want to generate the static website
[ ] GenieStatic.build iterates over Genie.Router.routes() and pulls the full page at the route's URL (using HTTP.jl, taking into account the method [ie GET, POST, etc])
--> would it make sense to only include GET by default? We should research what other static generators do. But it doesn't make a lot of sense to include non-GET routes, as these are for creating/updating/deleting.
[ ] GenieStatic.build saves the pulled page creating the correct folders path if it doesn't exist (ex path /a/b/c should create folders "a", "b", "c"). If the route does not indicate a document name, the page should be saved as index.html
[ ] When it's done pulling and saving the pages, GenieStatic.build should copy the /public folder into the root of the saved website

@essenciary essenciary converted this from a draft issue Oct 7, 2024
@KwatMDPhD KwatMDPhD self-assigned this Oct 7, 2024
@KwatMDPhD
Copy link
Collaborator

I have completed the requirements mentioned above. However, doing just those does not work with Genie's default layout because Quasar is looking for a server. When I try to use my layout, Quasar does not render.

@essenciary
Copy link
Member Author

essenciary commented Nov 14, 2024

@KwatMDPhD I see what you mean, and yes the static site generator as designed won't work with reactive apps. In my mind this was for converting dynamic Genie.jl (MVC) websites (including with dynamic database powered pages) to static pages.

To render JS for Quasar apps, a web browser is needed - it can be a headless one and there are lots of libraries providing this (though not for Julia as far as I know). So, we'd need to bundle some headless browser, parse the page and run the JS. However, this won't solve the problem that Stipple.jl pages need a backend for full reactivity, so regular Stipple.jl apps would be broken when exported as static (cause the backend won't be available to sync data an run the backend functions).

Can you explain your use case?

@essenciary
Copy link
Member Author

There was this but now it's abandoned https://github.com/fredo-dedup/HeadlessChromium.jl

@KwatMDPhD
Copy link
Collaborator

I'm glad that we're on the same page.

If I use the default layout (which has code for stipple, vue, quasar, channel, and other reactivity functions), then the HTML that I GET and write does not render or renders with errors when you inspect the console.

To resolve this issue, I copied the default layout and painstakingly removed each line to determine which lines were integral to reactivity, so I removed all lines needed for reactivity. After doing this, I could not use any quasar components. I concluded that quasar components are inherently reactive and need a server.

Finally, I settled on using my own layout, which relies only on tailwind (no vue, quasar, channel, or other reactive elements). This allows me to use GenieStatic to save pages as HTML for static rendering.

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

No branches or pull requests

2 participants