Skip to content

Commit f519f56

Browse files
committed
Add documentation for including other Taskfiles
1 parent 5eb1a1f commit f519f56

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

docs/usage.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ tasks:
4848
hallo: welt
4949
```
5050
51-
## OS specific task
51+
## Operating System specific tasks
5252
5353
If you add a `Taskfile_{{GOOS}}.yml` you can override or amend your Taskfile
5454
based on the operating system.
@@ -86,6 +86,31 @@ It's also possible to have an OS specific `Taskvars.yml` file, like
8686
`Taskvars_windows.yml`, `Taskfile_linux.yml`, or `Taskvars_darwin.yml`. See the
8787
[variables section](#variables) below.
8888

89+
## Including other Taskfiles
90+
91+
If you want to share tasks between different projects (Taskfiles), you can use
92+
the importing mechanism to include other Taskfiles using the `includes` keyword:
93+
94+
```yaml
95+
version: '2'
96+
97+
includes:
98+
docs: ./documentation # will look for ./documentation/Taskfile.yml
99+
docker: ./DockerTasks.yml
100+
```
101+
102+
The tasks described in the given Taskfiles will be available with the informed
103+
namespace. So, you'd call `task docs:serve` to run the `serve` task from
104+
`documentation/Taskfile.yml` or `task docker:build` to run the `build` task
105+
from the `DockerTasks.yml` file.
106+
107+
> The included Taskfiles must be using the same schema version the main
108+
> Taskfile uses.
109+
110+
> Also, for now included Taskfiles can't include other Taskfiles.
111+
> This was a deliberate decision to keep use and implementation simple.
112+
> If you disagree, open an GitHub issue and explain your use case. =)
113+
89114
## Task directory
90115

91116
By default, tasks will be executed in the directory where the Taskfile is

0 commit comments

Comments
 (0)