Jakefile Syntax
Comments
Section titled “Comments”# This is a commenttask foo: # Inline comment echo "Hello"Doc Comments
Section titled “Doc Comments”Comments placed immediately before a recipe (no blank lines) are captured as documentation and shown in jake -l:
# Build the application binarytask build: zig buildA blank line between the comment and recipe prevents capture, making it easy to use section headers:
# ============================================# Build Section# ============================================
task build: # This has no doc comment zig buildFor inline descriptions, use @desc (shown in the same line as the recipe name):
@desc "Build the application"task build: zig buildIndentation
Section titled “Indentation”Commands must be indented with 4 spaces or 1 tab:
task example: echo "Line 1" echo "Line 2"Line Continuation
Section titled “Line Continuation”Long commands can span multiple lines using shell continuation:
task long-command: echo "This is a very long command" \ "that spans multiple lines"Variables
Section titled “Variables”Defining Variables
Section titled “Defining Variables”name = "Jake";version = "1.0.0";Using Variables
Section titled “Using Variables”Use {{variable}} syntax in commands:
greeting = "Hello"target = "World"
task greet: echo "{{greeting}}, {{target}}!"Output: Hello, World!
Variable Scope
Section titled “Variable Scope”Variables are global and available to all recipes:
project = "myapp"
task build: echo "Building {{project}}"
task test: echo "Testing {{project}}"Recipe Types
Section titled “Recipe Types”Jake supports three types of recipes:
| Type | Keyword | Runs When | Best For |
|---|---|---|---|
| Task | task | Always | Commands, scripts, development |
| File | file | Output missing or dependencies changed | Build artifacts, compilation |
| Simple | (none) | Always | Quick recipes, Make-like syntax |
Task Recipes
Section titled “Task Recipes”Always run when invoked:
task clean: rm -rf dist/
task dev: npm run devFile Recipes
Section titled “File Recipes”Only run if output is missing or dependencies changed:
file dist/app.js: src/**/*.ts esbuild src/index.ts --bundle --outfile=dist/app.jsSimple Recipes
Section titled “Simple Recipes”No keyword, Make-like syntax:
build: cargo build
test: [build] cargo testRecipe Aliases
Section titled “Recipe Aliases”Define alternative names:
task build | b | compile: cargo buildNow jake build, jake b, and jake compile all work.
Private Recipes
Section titled “Private Recipes”Hide recipes from jake --list using either method:
Underscore Prefix
Section titled “Underscore Prefix”Prefix the recipe name with _:
task _internal-helper: echo "Hidden from jake --list"
task public-task: [_internal-helper] echo "Uses the private helper"@hidden Directive
Section titled “@hidden Directive”Use the @hidden directive before the recipe:
@hiddentask internal-helper: echo "Hidden from jake --list"
task public-task: [internal-helper] echo "Uses the private helper"Both methods hide the recipe from normal listings. Use jake --all or jake -a to see all recipes including hidden ones.