Pages.Generate

This module provides some functions for scaffolding code for a new Route Module. It uses elm-codegen's API for generating code.

Typically you'll want to use this via the elm-pages codegen CLI command. The default starter template includes a file that uses these functions, which you can tweak to customize your scaffolding commands. Learn more about the elm-pages run CLI command in its docs page.

Initializing the Generator Builder

{ view :
Expression -> Expression -> Expression -> Expression -> Expression
, update :
Expression
-> Expression
-> Expression
-> Expression
-> Expression
-> Expression
, init : Expression -> Expression -> Expression -> Expression
, subscriptions :
Expression
-> Expression
-> Expression
-> Expression
-> Expression
-> Expression
, msg : Type
, model : Type
}
-> File
{ view :
Expression -> Expression -> Expression -> Expression -> Expression
, update :
Expression
-> Expression
-> Expression
-> Expression
-> Expression
-> Expression
, init : Expression -> Expression -> Expression -> Expression
, subscriptions :
Expression
-> Expression
-> Expression
-> Expression
-> Expression
-> Expression
, msg : Type
, model : Type
}
-> File
{ view : Expression -> Expression -> Expression -> Expression }
-> File
type Builder
type Type
= Alias Annotation
| Custom (List Variant)

Generating Server-Rendered Pages

{ data : ( Type, Expression -> Expression )
, action : ( Type, Expression -> Expression )
, head : Expression -> Expression
, moduleName : List String
}

Generating pre-rendered pages

{ data : ( Type, Expression -> Expression )
, pages : Expression
, head : Expression -> Expression
, moduleName : List String
}
{ data : ( Type, Expression )
, head : Expression -> Expression
, moduleName : List String
}