mix compile.gleam_js (Lissome v0.2.0)

View Source

Compile Gleam source files to JavaScript and then bundle them using esbuild binary

Built files are placed in the priv/static/gleam folder.

Examples:

# Compile Gleam to Javascript in a Mix project
# and bundle with esbuild in minified mode
mix compile.gleam_js --minify

Gleam compilation will not occur where no .gleam files are located.

To use this taks, first make sure you have the Gleam to Erlang compiler gleam from mix_gleam in your compilers list, then include this task in your project's mix.exs with, e.g.:

def project do
  [
    compilers: [:gleam, :gleam_js] ++ Mix.compilers(),
  ]
end

Credit goes to the mix_gleam project, on which this compiler has been modeled.