Elm-spa: a tool for building single page apps

@Thorsten, there is a conversation about this at https://github.com/ryannhg/elm-spa/issues/12

2 Likes

Great! Exposing fromGlobalMsg is just what I need! Thanks for pointing out the discussion on github!

Hey there!
It would be really nice if the option --ui=Element was usable with elm-spa init (and then automatically applied with elm-spa add commands).
I converted a freshly generated project, but it takes time… I am under the impression that a lot of people like to use elm-ui, so it may be useful to get this from the cli tool :slight_smile:

1 Like

100% agreed! I’m trying to work out a way to make elm-ui feel much more natural.

Super eager to share the latest progress, but it turns out this stuff takes forever :turtle:

But hopefully the result is a really useful thing :crossed_fingers:

5 Likes

This is very nice to read! I can’t wait you give us some news :slight_smile:
A tool like this one is very valuable for the spread of the language.

I took a look at the CLI code to see if I would be able to propose a PR, but I fear this is beyond my current Elm skills ^^

That’s perfectly okay, I value conversations over PRs!

My latest updates reworked the project structure quite a bit– so PRs stress me out :sweat_smile:

1 Like

As owner of several git repositories at work, I can totally relate to that :smiley:
Keep up the good work!

2 Likes

I wanted to check the examples again, and I saw the new complex example. I saw dynamic params, and transitions, that seems very interesting! I cannot run it though, because I don’t have the right version of elm-spa… Will the CLI be able to generate pages with dynamic params?

You can look at the branch old-news for the alpha example:

You can expect dynamic params to work with elm-spa commands in the next release :slight_smile:

Next up, after I fix elm-spa init and elm-spa add for the latest API endpoints, I’ll be working for a bit on better documentation. That will have solid examples of how to answer a lot of the questions raised here and on GitHub!

10 Likes

Can we create a slack or discord channel for discussing this tool? I really like it and I think it could grow but we would need a better communication tool for that.

2 Likes

Hello @RyanNHG !
I am trying the new version now. It is very nice to be able to generate an app directly with elm-ui!

I know you are working on documentation right now, but could you juste give a hint of how dynamic params can be specified? I have the feeling it has to do with overloading the Recipe type alias, but I’m not sure if that’s true and if yes how to do it…

@ganlhi Sure thing!

So if you run this command:

elm-spa add sandbox Users.Dynamic

Your init function will look like this:

import Generated.Users.Params as Params

init : Params.Dynamic -> Model
init { params1 } =
  { userId = params1
  }

For each Dynamic in the module name, you can access a String parameter.

This works for nested things like:

/posts/123/authors/ryan

If you create a page at Posts/Dynamic/Authors/Dynamic.elm the init function will have param1 as "123" and param2 == "ryan"

@karantan hoping to request a slack channel soon,
waiting until https://elm-spa.dev is live :sunglasses:

Thanks again for all the support and encouragement, I spent like 4 hours after work last night working on the docs.

It’s super motivating to get all this positive feedback so early on :heart:

I can’t wait to show you the guide!

Thank you for the explanation!

For the nested example, can I use the cli like this to achieve this result ?

elm-spa add sandbox Project.Dynamic.Mission.Dynamic

EDIT: it doesn’t seem to work. I mean, the Elm file has been created correctly in src/Pages/Project/Dynamic/Mission/Dynamic.elm. But as I run the app, I get this error:

-- NAMING ERROR --------------- /home/gbrouat/dev/perso/elm/TestSpaUi/elm-stuff/.elm-spa/Generated/Routes.elm

I cannot find a `Generated.Route.Project_Folder` variant:

51|             Generated.Route.Project_Folder <|
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The `Generated.Route` module does not expose a `Project_Folder` variant. These
names seem close though:

    Generated.Route.Counter_Folder
    Generated.Route.NotFound
    Generated.Route.Top
    Generated.Counter.Route.Dynamic

Hint: Read <https://elm-lang.org/0.19.1/imports> to see how `import`
declarations work in Elm.,-- NAMING ERROR --------------- /home/gbrouat/dev/perso/elm/TestSpaUi/elm-stuff/.elm-spa/Generated/Routes.elm

I cannot find a `Generated.Project.Route.Dynamic_Folder` variant:

52|                 Generated.Project.Route.Dynamic_Folder param1 <|
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I cannot find a `Generated.Project.Route` import. These names seem close though:

    Generated.Counter.Route.Dynamic
    Generated.Route.Counter_Folder
    Generated.Route.NotFound
    Generated.Route.Top

Hint: Read <https://elm-lang.org/0.19.1/imports> to see how `import`
declarations work in Elm.,-- NAMING ERROR --------------- /home/gbrouat/dev/perso/elm/TestSpaUi/elm-stuff/.elm-spa/Generated/Routes.elm

I cannot find a `Generated.Project.Dynamic.Route.Mission_Folder` variant:

53|                     Generated.Project.Dynamic.Route.Mission_Folder <|
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I cannot find a `Generated.Project.Dynamic.Route` import. These names seem close
though:

    Generated.Project.Dynamic.Mission.Route.Dynamic
    Generated.Route.Counter_Folder
    Generated.Counter.Route.Dynamic
    Generated.Route.NotFound

Hint: Read <https://elm-lang.org/0.19.1/imports> to see how `import`
declarations work in Elm.

@ganlhi - That’s a bug with the elm-spa build command.

In theory, the answer is yes. Looks like I didn’t generate a route file for each folder on the way :sweat_smile:

If you can open a GitHub issue, that would be awesome. Planning on working a lot on the project this weekend :sunglasses:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.