A tool to generate HTML code from Elm source in the terminal using [QuickJS](https://bellard.org/quickjs/). # Design QuickJS (Qjs) is a [JavaScript runtime](https://en.wikipedia.org/wiki/List_of_JavaScript_engines), similar to V8 or SpiderMonkey, but lighter and faster. As any runtime, Qjs can interpret JavaScript code, but it is not a web browser. It has no concept of an HTML document. To bridge this gap, we add a minimal [DOM](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model) implementation. Next, we concatenate this with the Elm JavaScript output and an app launcher snippet, then ask Qjs to interpret all of it. ## Limitations * No event loop * Hence, no [TEA](https://guide.elm-lang.org/architecture/); the `main` function must return a static view * The Elm app module must be called "Main" * Nodes can only have one parent (this should always be the case) # Usage 1. Clone this repository and navigate into your local copy 2. Run `elm init`. 3. Create `src/Main.elm` with the following content: ```elm module Main exposing(main) import Html exposing (p, text) main = p [] [text "Hello World!"] ``` 4. Run `./build.sh`; this generates the corresponding HTML code: ```html
Hello World!
``` # Prior Work There are more complete tools for generating static sites with Elm: * [elm-pages](https://elm-pages.com/) * [elmstatic](https://korban.net/elm/elmstatic) * [elm-starter](https://github.com/lucamug/elm-starter) * [siteelm](https://github.com/nikueater/siteelm) You should probably consider using one of them instead of this one. :)