mix xenia.gen.page (Xenia v0.1.1)

Copy Markdown View Source

Generates a page.ex in the app folder, which makes its folder a route.

$ mix xenia.gen.page reports/sales
* creating lib/my_app_web/app/reports/sales/page.ex

The folder follows the app-folder conventions: (group) folders stay out of the URL, [id] is a parameter and [...path] a catch-all. Quote such paths in your shell:

$ mix xenia.gen.page "(auth)/runbooks/[id]"

What you get:

  • a LiveView with use Xenia.Page, drawn inside the layouts above it. Parameters are assigned in mount/3.
  • under a live.ex, a module with only render/1: the live.ex owns the state and the events of the pages below it.

The module name mirrors the folders, MyAppWeb.App.Reports.SalesPage. The page is routed the next time the router compiles. A path that would conflict with an existing page is refused.

Options

  • --module - the module name
  • --root - the app folder, lib/my_app_web/app by default
  • --web-module and --web-path - MyAppWeb and lib/my_app_web by default
  • --force - overwrite an existing file