Taskfile Includes & Modular Configuration
Intermediatev1.0.0
Split large Taskfile configurations into modular includes — namespaced task groups, shared variables, monorepo support, and DRY patterns for complex projects.
Content
Overview
Taskfile includes let you split a large configuration into multiple files, each responsible for a domain (docker, testing, deployment). Included files get namespaced automatically, preventing name collisions and keeping each file focused.
Why This Matters
- -Maintainability — small focused files instead of one massive Taskfile
- -Namespacing — docker:build, test:unit, deploy:staging
- -Reusability — shared task definitions across projects
- -Monorepo support — per-package Taskfiles with shared root
How It Works
Step 1: Split into Files
Step 2: Root Taskfile with Includes
Step 3: Included Taskfile
Step 4: Usage
Monorepo Pattern
Best Practices
- -One file per domain — docker.yml, test.yml, deploy.yml
- -Use dir with includes for monorepo packages (sets working directory)
- -Share variables from root — included files inherit root vars
- -Namespace consistently — docker:build, docker:push, docker:run
- -Keep root Taskfile thin — orchestration only, details in includes
Common Mistakes
- -Too many includes (diminishing returns past 5-6)
- -Not setting dir for monorepo includes (wrong working directory)
- -Circular includes (A includes B includes A)
- -Duplicating variables in included files (inherit from root)
FAQ
Discussion
Loading comments...