Skip to content

using elm-live with SPA #156

@SimonLab

Description

@SimonLab

elm-live can be used to compile a Elm single page application.
You can install elm-live with npm: npm install -g elm-live and then you'll be able to run the following command:

elm-live src/Main.elm --pushstate -- --output elm.js

the command above will compile the src/Main.elm file.
The documentation (elm-live --help) for the flag --pushstate` is:

Forces the index.html or whatever filename you have passed to the --start-page flag to always be served. Must be used when building with Browser.application. (default: false)

This means that any endpoint of the application will use the same start origin instead of looking for a specific file.

Then all the flags defined after -- are sent directly to elm make instead of elm-live. In our case the Elm application will be compiled to the output file elm.js. By default elm-live compile the application to index.html which means that if you have already an index file it will be overridden.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions