dillonkearns/elm-pages-v3-beta/15.0.2

NOTE: the latest version is 21.0.0

Scaffold.Route

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 :
{ maybeUrl : Expression
, sharedModel : Expression
, model : Expression
, app : Expression
}
-> Expression
, update :
{ pageUrl : Expression
, sharedModel : Expression
, app : Expression
, msg : Expression
, model : Expression
}
-> Expression
, init :
{ pageUrl : Expression
, sharedModel : Expression
, app : Expression
}
-> Expression
, subscriptions :
{ maybePageUrl : Expression
, routeParams : Expression
, path : Expression
, sharedModel : Expression
, model : Expression
}
-> Expression
, msg : Type
, model : Type
}
-> { path : String
, body : String
}
{ view :
{ maybeUrl : Expression
, sharedModel : Expression
, model : Expression
, app : Expression
}
-> Expression
, update :
{ pageUrl : Expression
, sharedModel : Expression
, app : Expression
, msg : Expression
, model : Expression
}
-> Expression
, init :
{ pageUrl : Expression
, sharedModel : Expression
, app : Expression
}
-> Expression
, subscriptions :
{ maybePageUrl : Expression
, routeParams : Expression
, path : Expression
, sharedModel : Expression
, model : Expression
}
-> Expression
, msg : Type
, model : Type
}
-> { path : String
, body : String
}
{ view :
{ maybeUrl : Expression
, sharedModel : Expression
, app : Expression
}
-> Expression
}
-> { path : String
, body : String
}
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
}

Including Additional elm-codegen Declarations

addDeclarations : List Declaration -> Builder -> Builder

CLI Options Parsing Helpers

Option from String builderState
-> Option from (List String) builderState

A positional argument for elm-cli-options-parser that does a Regex validation to check that the module name is a valid Elm Route module name.