elm-pages
v3.6.0
Published
Hybrid Elm framework with full-stack and static routes.
Maintainers
Readme
elm-pages

elm-pages is a framework for building an Elm single-page app that is able to seamlessly interface with data from an Elm Backend. elm-pages is a hybrid framework, allowing you to define Routes that are either server-rendered
(for more dynamic content with user-specific or request-specific data) or pre-rendered at build-time (for generating static HTML files that are hosted through a CDN). You can mix and match server-rendered and pre-rendered routes in your app.
elm-pages also has a command for running pure Elm scripts with a single command. See the elm-pages Scripts docs page.
What's new in 12.2
Tui— build interactive terminal apps as elm-pages scripts. TEA-styleinit/update/viewthat renders styled text to the terminal and responds to keyboard, mouse, paste, resize, and time events.Tui.programOrScriptlets the same script behave interactively in a TTY and as a plainBackendTaskunder CI or when its output is piped.Test.PagesProgram— end-to-end tests for elm-pages routes. Drive the real framework runtime through form submissions, optimistic UI, concurrent fetchers, redirects, session cookies, and error pages with simulated HTTP and custom ports. Deterministic, in-process, no browser. Inspired by elm-program-test.Test.Tui— pure Elm tests for TUI programs. Simulate keypresses and mouse events, resolve pendingBackendTasks with theTest.BackendTasksimulators, and assert on screen output.- Visual test runner —
elm-pages devserves page tests in the browser at/_tests, andelm-pages test --visualsteps through TUI tests in the terminal. Run tests headlessly withelm-pages test.
See examples/smoothies/tests/ and examples/todos/tests/ for route tests, and examples/end-to-end/script/tests/TuiStarsTests.elm for a TUI test.
Getting Started Resources
- elm-pages Docs Site
- elm-pages site showcase
- elm-pages Elm API Docs
- Quick start repo (live site hosted here)
- Introducing
elm-pagesblog post examplesfolder (includes https://elm-pages.com site source) Usegit clone --recurse-submodules https://github.com/dillonkearns/elm-pages.gitso that there aren't missing files when you try to build the examples.
Compatibility Key
You will see an error if the NPM and Elm package do not have a matching Compatibility Key. Usually it's best to upgrade to the latest version of both the Elm and NPM packages when you upgrade. However, in case you want to install versions that are behind the latest, the Compatibility Key is included here for reference.
Current Compatibility Key: 30.
Why is elm/virtual-dom held at 1.0.5?
elm-pages compiles your app with Lamdera, and Lamdera 1.5.0 swaps in its own copy of elm/virtual-dom, based on elm-safe-virtual-dom. That copy is what keeps your app working when a browser extension changes the page, and it is how frozen views are drawn from the server's HTML.
Each Lamdera release only accepts the elm/virtual-dom versions it knows about. Lamdera 1.5.0 accepts up to 1.0.5, and stops with an error if your elm.json asks for a newer one:
"elm/virtual-dom": "1.0.0 <= v <= 1.0.5"
But your elm.json contains:
"elm/virtual-dom": "1.0.6"
You need to update the Lamdera compiler.So the elm-pages Elm package asks for exactly elm/virtual-dom 1.0.5. If you see the error above, or a dependency conflict about elm/virtual-dom when you install elm-pages, set elm/virtual-dom to 1.0.5 in your elm.json. Nothing is lost by this: Lamdera uses its own copy either way. The limit will go up when a Lamdera release accepts a newer version.
