Task
Watch Mode Commands
Run tasks automatically when source files change using watch mode and sources/generates.
12 commands
Pro Tips
Define sources and generates for smart rebuilds
Commands
Watch mode
$ task --watch build
Run task on file changes.
Define sources
$ tasks:
build:
sources:
- src/**/*.go
generates:
- bin/app
cmds:
- go build -o bin/app
Define sources for smart rebuilds.
Watch interval
$ task --watch --interval 500ms build
Set watch polling interval.
Checksum method
$ tasks:
build:
method: checksum
sources:
- src/**/*.go
cmds:
- go build -o bin/app
Use checksum to detect file changes.
Timestamp method
$ tasks:
build:
method: timestamp
sources:
- src/**/*.go
generates:
- bin/app
cmds:
- go build -o bin/app
Use timestamps for up-to-date checks.
Watch multiple sources
$ tasks:
dev:
sources:
- src/**/*.ts
- config/**/*.json
- templates/**/*.html
cmds:
- npm run build
Watch multiple file patterns at once.
Exclude from sources
$ tasks:
build:
sources:
- src/**/*.go
- exclude: src/**/*_test.go
cmds:
- go build -o bin/app
Exclude specific files from sources.
Namespaced includes
$ includes:
api:
taskfile: ./api/Taskfile.yml
dir: ./api
Namespace included tasks with dir context.
Run namespaced task
$ task api:build
Run a task from an included namespace.
Output prefixed mode
$ output: prefixed
tasks:
build:
prefix: BUILD
cmds:
- go build -o app
Prefix output lines with task name.
Output interleaved
$ output: interleaved
Interleave output from parallel tasks.
Remote taskfile
$ includes:
remote: https://raw.githubusercontent.com/org/repo/main/Taskfile.yml
Include a Taskfile from a remote URL.