# `mix xenia.gen.layout`
[🔗](https://github.com/uzaydurdu/xenia/blob/v0.1.1/lib/mix/tasks/xenia.gen.layout.ex#L1)

Generates a `layout.ex` in the app folder: a frame around every page in
its folder and below.

    $ mix xenia.gen.layout "(auth)" --persistent --on-mount MyAppWeb.Auth:require_user
    * creating lib/my_app_web/app/(auth)/layout.ex
    * creating lib/my_app_web/app/(auth)/persistent.ex

Pass `.` for the root layout, which frames every page. It wraps them in
your app's `<Layouts.app>`, the place for it once pages come from the
folder.

## Options

  * `--persistent` - also generate the layout's `persistent.ex`: a
    LiveView (`use Xenia.Persistent`) that stays alive while the user
    moves between the layout's pages. The frame places it with
    `{@persistent}`. With an existing `layout.ex`, only `persistent.ex` is
    created; add `{@persistent}` to that frame yourself.
  * `--on-mount` - an `on_mount` hook for every page under the layout,
    such as an authentication check: `MyAppWeb.Auth` or
    `MyAppWeb.Auth:require_user`. Refused below a `live.ex`, where
    switching pages mounts nothing.
  * `--module` and `--persistent-module` - the module names. By default
    they mirror the folders: `MyAppWeb.App.AuthLayout` and
    `MyAppWeb.App.AuthPersistentLive`.
  * `--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 existing files

---

*Consult [api-reference.md](api-reference.md) for complete listing*
