CLI

Ema apps have a basic CLI argument structure that you can invoke in two possible ways:

  • run subcommand (or, no subcommand specified): Run the Live Server.
    • A random port is used unless you specify one explicitly (--port)
    • Pass --no-ws if you want to disable the “live” aspect of the server.
  • gen subcommand: Generate the static site, instead of starting up the Live Server

The subcommand is passed as the Ema.CLI.Action type to your siteInput function in EmaSite.

You can also use runEmaWith if you are manually handling the CLI arguments yourself and delegating to ema using Ema.CLI wherever appropriate.

Links to this page
  • Live Server

    The “run” command of CLI runs the live-server, as opposed to the “gen” command which generates the static site one off. The live-server is a simple HTTP server that serves the Ema site “on the fly” (without doing O(n) static-site generation). Furthermore, changes to your Model type (via Dynamic) will automatically Hot Reload the browser clients to display the new HTML as rendered using the new model value.

  • Hello World
    Running the resultant executable without arguments runs the Live Server, whereas running it with the gen subcommand will generate the static site (see CLI).