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

Use directory as layout structure #9

Open
giautm opened this issue Jan 2, 2025 · 1 comment
Open

Use directory as layout structure #9

giautm opened this issue Jan 2, 2025 · 1 comment

Comments

@giautm
Copy link
Contributor

giautm commented Jan 2, 2025

Consider another approach for layout structure: https://docs.expo.dev/router/layouts Instead of parsing the marker at beginning of files

app
 _layout.html
 home
  _layout.html
  index.html
@giautm giautm changed the title layout engine, Use directory as layout structure Jan 2, 2025
@cnlangzi
Copy link
Member

cnlangzi commented Jan 2, 2025

Xun's Page Router is inspired by Nextjs's Page Router. It is same as expo's as you mentioned. But there are 3 problems.

  • directory is used in layout setup and routing
  • override layout issue on page level
  • layout might be mixed when host precedence is there.

re 1st, he has to keep an eye on directory when developers define their API routing. Because there is a directory limitation on its html viewer from Page Router.
re 2nd, a workaround is required.
re 3rd, a workaround is required too.

In Xun's design pattern, Handler Routing is a first-class citizen. Developers should feel free to define their API routing, with the Page Router following suit as merely an HTML viewer.

This is why the <!--layout:xx--> marker is introduced, allowing developers the freedom to apply any pattern to their APIs.

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

No branches or pull requests

2 participants