Skip to content

Imports & modules

How to split tasks across files and compose them. Part of the guides; full syntax in the language guide.

Two ways to compose Runefiles:

  • import splices another file’s tasks and variables into the current namespace — good for shared helpers.
  • mod loads another file as a namespace, invoked with a prefix (rune api::build) — good for isolating per-service or per-package tasks in a monorepo.
import "common.rune" # splice tasks/vars into this file
import? "optional.rune" # ignore if the file is missing
mod api "services/api.rune" # namespace: rune api::build
mod web "services/web.rune"

See examples/monorepo — a shared import plus two mod namespaces, with the helper files shipped alongside so it runs as-is.

  • Name collisions are reported, not silently merged. Importing two tasks with the same name is a conflict — use mod namespaces to keep them distinct.
  • Paths are relative to the importing file. mod api "services/api.rune" resolves from the Runefile’s directory.
  • import? is for optional files only. A plain import of a missing file is an error; use import? when absence is acceptable.