Watch Mode
Basic Watch
Section titled “Basic Watch”Re-run recipe when files change:
jake -w buildJake watches files based on:
- File dependencies in file recipes
@watchdirectives in tasks
Watch Specific Patterns
Section titled “Watch Specific Patterns”jake -w "src/**/*.ts" buildWatch Directive
Section titled “Watch Directive”Mark files to watch in a task:
task build: @watch src/*.ts npm run buildMultiple patterns:
task dev: @watch src/**/*.ts tests/**/*.ts npm run devWatch with Verbose Output
Section titled “Watch with Verbose Output”jake -w -v buildShows which files triggered the rebuild.
Conditional Watch Behavior
Section titled “Conditional Watch Behavior”Use is_watching() to adjust behavior:
task build: @if is_watching() echo "Watch mode: skipping expensive lint" @else npm run lint @end npm run buildCombining with Other Flags
Section titled “Combining with Other Flags”# Watch with verbose outputjake -w -v build
# Watch with parallel jobsjake -w -j4 build