Imports

One justfile can include the contents of another using import statements.

If you have the following justfile:

import 'foo/bar.just'

a: b
  @echo A

And the following text in foo/bar.just:

b:
  @echo B

foo/bar.just will be included in justfile and recipe b will be defined:

$ just b
B
$ just a
B
A

The import path can be absolute or relative to the location of the justfile containing it. A leading ~/ in the import path is replaced with the current users home directory.

Justfiles are insensitive to order, so included files can reference variables and recipes defined after the import statement.

Imported files can themselves contain imports, which are processed recursively.

When allow-duplicate-recipes is set, recipes in parent modules override recipes in imports. In a similar manner, when allow-duplicate-variables is set, variables in parent modules override variables in imports.

Imports may be made optional by putting a ? after the import keyword:

import? 'foo/bar.just'

Missing source files for optional imports do not produce an error.