Jakefile Syntax
Comments
Section titled “Comments”# This is a commenttask foo: # Inline comment echo "Hello"Indentation
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”Prefix with _ to hide from listings:
task _internal-helper: echo "Hidden from jake --list"
task public-task: [_internal-helper] echo "Uses the private helper"