0.1.0
A Deno wrapper around the Elm compiler
Repository
Current version released
6 years ago
Dependencies
std
Versions
deno_elm_compiler
A partial port of @rtfeldmanβs node-elm-compiler to Deno.
| Supports | node-elm-compiler | deno-elm-compiler |
|---|---|---|
| compile | β | β |
| compileSync | β | β |
| compileWorker | β | β |
| compileToString | β | β |
| compileToStringSync | β | β |
| compileToModule | β | β |
| compileToModuleString | β | β |
| findAllDependencies | β imported from find-elm-dependencies | β |
| _prepareProcessArgs | β | β |
Usage
Given some Elm code like
module Main exposing (main)
import Html
main =
Html.text "Hello from Elm!"in a build file do
import { compileToModule } from "https://raw.githubusercontent.com/wolfadex/deno_elm_compiler/master/compiler.ts";
await compileToModuleString("./src/Main.elm", { output: "./src/elm.js" });then run your bulid script with Deno
deno run --allow-env --allow-run --allow-write --allow-read build.ts--allow-envis required to pass in ENV variables to the Elm compiler--allow-runis required to allow Deno to run the Elm compiler--allow-writeis required for writing a module and for compiling to a string--allow-readis required for compiling to a string
after you can consume your Elm code like any of the following
import Elm from "./src/elm.js";
Elm.Main.init();
//----------- OR ---------------
import { Main } from "./src/elm.js";
Main.init({ node: document.getElementById("elm-root") });For more details on Elm and Javascript interop, see the Elm docs.
Todo:
- Add a cli wrapper so you can optionally do
deno-elm src/Main.elm --optimize --module --output=src/elm.js