mix_gleam v0.6.2 mix compile.gleam
Compiles a single Gleam package.
This task wraps gleam compile-package
and ensures that any Gleam code, in the main
project and any dependencies, is compiled into Erlang, a task that should happen
prior to Mix's compilation.
Examples:
# Compile Gleam to Erlang in the Mix project.
mix compile.gleam
# Compile Gleam to Erlang in a dependency.
mix compile.gleam gleam_stdlib
# Compile several dependencies.
mix compile.gleam gleam_http gleam_otp
# Force Gleam compilation.
mix compile.gleam gleam_plug --force
# Prevent Gleam compilation.
mix deps.compile --no-gleam
Note that Gleam compilation can also be explicitly disabled for individual dependencies
via mix.exs
using, e.g.:
defp deps() do
[
...
{:package, "~> 0.1", gleam: false},
]
end
Gleam compilation will not be attempted in cases where it is thought to be unnecessary,
unless the --force
or --force-gleam
flag or config option is passed; though even then,
Gleam compilation will not occur where no .gleam
files are located.
Include this task in your project's mix.exs
with, e.g.:
def project do
[
compilers: [:gleam] ++ Mix.compilers(),
]
end