Plugin Reference
RouterPlugin
RouterPlugin discovers filesystem route modules and generates a lazy `virtual:router` module.
Route Files
The router is optional and framework-agnostic. It supports +page.rb, +page.haml, +route.rb, +layout.*, +error.*, and +not-found.*.
Klenod::Build::Plugins::RouterPlugin.new(
specifier: "virtual:router",
pages_dir: "routes",
extensions: [".rb", ".haml"]
)
Generated router modules use lazy imports so development startup does not evaluate every page.
Segments
Supported segment shapes include dynamic segments, catch-all segments, optional catch-all segments, route groups, parallel routes, and intercepted routes.
[id]
[...slug]
[[...slug]]
(marketing)
@modal
(.)photo
Framework Policy
Matching routes belongs to the generated router. Rendering pages, deciding hybrid route.rb behavior, choosing content negotiation, and turning errors into responses belongs to the framework or server.