Imports & modules
How to split tasks across files and compose them. Part of the guides; full syntax in the language guide.
Concept
Section titled “Concept”Two ways to compose Runefiles:
importsplices another file’s tasks and variables into the current namespace — good for shared helpers.modloads another file as a namespace, invoked with a prefix (rune api::build) — good for isolating per-service or per-package tasks in a monorepo.
Syntax
Section titled “Syntax”import "common.rune" # splice tasks/vars into this fileimport? "optional.rune" # ignore if the file is missing
mod api "services/api.rune" # namespace: rune api::buildmod web "services/web.rune"Runnable example
Section titled “Runnable example”See examples/monorepo — a shared import plus two mod
namespaces, with the helper files shipped alongside so it runs as-is.
Pitfalls
Section titled “Pitfalls”- Name collisions are reported, not silently merged. Importing two tasks with the same
name is a conflict — use
modnamespaces 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 plainimportof a missing file is an error; useimport?when absence is acceptable.
Next steps
Section titled “Next steps”- Dependencies & post-hooks — depend on tasks across files.
- Settings & dotenv — what imported files can configure.