Skip to content

Jakefile Syntax

# This is a comment
task foo: # Inline comment
echo "Hello"

Commands must be indented with 4 spaces or 1 tab:

task example:
echo "Line 1"
echo "Line 2"

Long commands can span multiple lines using shell continuation:

task long-command:
echo "This is a very long command" \
"that spans multiple lines"
name = "Jake"
version = "1.0.0"

Use {{variable}} syntax in commands:

greeting = "Hello"
target = "World"
task greet:
echo "{{greeting}}, {{target}}!"

Output: Hello, World!

Variables are global and available to all recipes:

project = "myapp"
task build:
echo "Building {{project}}"
task test:
echo "Testing {{project}}"

Jake supports three types of recipes:

TypeKeywordRuns WhenBest For
TasktaskAlwaysCommands, scripts, development
FilefileOutput missing or dependencies changedBuild artifacts, compilation
Simple(none)AlwaysQuick recipes, Make-like syntax

Always run when invoked:

task clean:
rm -rf dist/
task dev:
npm run dev

Only run if output is missing or dependencies changed:

file dist/app.js: src/**/*.ts
esbuild src/index.ts --bundle --outfile=dist/app.js

No keyword, Make-like syntax:

build:
cargo build
test: [build]
cargo test

Define alternative names:

task build | b | compile:
cargo build

Now jake build, jake b, and jake compile all work.

Prefix with _ to hide from listings:

task _internal-helper:
echo "Hidden from jake --list"
task public-task: [_internal-helper]
echo "Uses the private helper"