Lissome.GleamBuilder (Lissome v0.3.1)

View Source

Wrapper around the Gleam build tool.

This module provides functionality to build Gleam source files to either JavaScript or Erlang targets using the Gleam CLI.

Summary

Functions

Builds Gleam source files to the specified target using the gleam build command.

Functions

build_gleam(target, opts \\ [])

Builds Gleam source files to the specified target using the gleam build command.

The target can be :javascript, :erlang, or a list of both.

Returns :ok.

Options

  • :gleam_dir - Path to the Gleam project. Defaults to the :gleam_dir config in lissome, or "assets/lustre_app" if not set.
  • :compile_package - If true, uses gleam compile-package instead of gleam build (default: false).
  • :watch - If true, watches for file changes and rebuilds automatically. Requires the FileSystem package to be available (default: false).
  • :load_beam_modules - If true and the target is :erlang, loads compiled modules automatically (default: true).
  • :erlang_outdir - Custom output directory for Erlang beam files (only used with the :erlang target). Defaults to "{build_path}/lib/_{gleam_app}/", where gleam_app is the name from gleam.toml.

Examples

iex> Lissome.GleamBuilder.build_gleam(:erlang)

iex> Lissome.GleamBuilder.build_gleam([:javascript, :erlang])

iex> Lissome.GleamBuilder.build_gleam(:javascript,
...>   gleam_dir: "assets/my_gleam_app",
...>   compile_package: true,
...>   watch: true
...> )

is_valid_target(target)

(macro)