Renamed to ryan-haskell/elm-spa. It is published under that name, and new versions come out there.
Versions published as ryannhg/elm-spa still install under that name. 13 versions of 13 come from the new location (see their notes).
Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/ryan-haskell/elm-spa.
What we checked: The repo moved to github.com/ryan-haskell/elm-spa. Rebuilt with git archive from commit 0e39d0375e33 of https://github.com/ryan-haskell/elm-spa (zip prefix ryannhg-elm-spa-7424f50/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 089cd4d51e82160fd9c89219a7a6003338bcee3d.
The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.
Details · package.elm-lang.org's zip: https://github.com/ryannhg/elm-spa/zipball/4.1.0/
When you create an app with the elm/browser package, you can build anything from a static Html msg page to a fully-fledged web Browser.application.
elm-spa uses that design at the page-level, so you can quickly add new pages to your Elm application!
✅ Automatically generate routes and pages
✅ Read and update global state across pages
-- can render a static page
page : Page Flags Model Msg
page =
Page.static
{ view = view
}-- can keep track of page state
page : Page Flags Model Msg
page =
Page.sandbox
{ init = init
, update = update
, view = view
}-- can perform side effects
page : Page Flags Model Msg
page =
Page.element
{ init = init
, update = update
, subscriptions = subscriptions
, view = view
}-- can read and update global state
page : Page Flags Model Msg
page =
Page.component
{ init = init
, update = update
, subscriptions = subscriptions
, view = view
}The reason we return the same Page type is to make it super
easy to write top-level init, update, view, and susbcriptions functions.
(And if you're using the official cli tool, this code will be automatically generated for you)
initinit : Route -> Global.Model -> ( Model, Cmd Msg, Cmd Global.Msg )
init route =
case route of
Route.Home -> pages.home.init ()
Route.About -> pages.about.init ()
Route.Posts slug -> pages.posts.init slug
Route.SignIn -> pages.signIn.init ()updateupdate : Msg -> Model -> Global.Model -> ( Model, Cmd Msg, Cmd Global.Msg )
update bigMsg bigModel =
case ( bigMsg, bigModel ) of
( Home_Msg msg, Home_Model model ) ->
pages.home.update msg model
( About_Msg msg, About_Model model ) ->
pages.about.update msg model
( Posts_Msg msg, Posts_Model model ) ->
pages.posts.update msg model
( SignIn_Msg msg, SignIn_Model model ) ->
pages.signIn.update msg model
_ ->
always ( bigModel, Cmd.none, Cmd.none )view + subscriptions-- handle view and subscriptions in one case expression!
bundle : Model -> Global.Model -> { view : Document Msg, subscriptions : Sub Msg }
bundle bigModel =
case route of
Home_Model model -> pages.home.bundle model
About_Model model -> pages.about.bundle model
Posts_Model model -> pages.posts.bundle model
SignIn_Model model -> pages.signIn.bundle modelThe cli tool has commands like elm-spa init, elm-spa add, and elm-spa build for
generating your routes and pages for you!
npm install -g elm-spa
elm-spa init new-projectIf you'd rather define routes and pages by hand, you can add the elm package to your project:
elm install ryannhg/elm-spaThis repo comes with an example project that you can play around with. Add in some pages and see how it works!
git clone https://github.com/ryannhg/elm-spa
cd elm-spa/examples/html
npm startgit clone https://github.com/ryannhg/elm-spa
cd elm-spa/examples/elm-ui
npm startThe elm-spa will be running at http://localhost:8000