Skip to content

Variables

name = "Jake"
version = "1.0.0"
build_dir = "dist"

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}}"
@dotenv # Load .env
@dotenv ".env.local" # Load specific file

Files are loaded in order; later files override earlier ones.

@export NODE_ENV=production
@export DEBUG=false

Exported variables are passed to all subprocess commands.

Use $VAR or ${VAR} syntax:

task show:
echo "Node: $NODE_ENV"
echo "Debug: ${DEBUG}"
# Database settings
DATABASE_URL=postgres://localhost/myapp
DB_POOL_SIZE=10
# API Keys (use quotes for special chars)
API_KEY="abc123!@#"
# Empty values
EMPTY_VAR=
# Escape sequences
MULTILINE=line1\nline2
WINDOWS_PATH=C:\\Users\\Name

Supported escapes: \n, \t, \r, \\, \", \', \$

Validate required environment variables:

@require API_KEY DATABASE_URL
task deploy:
echo "Deploying with $API_KEY"

Jake exits with an error if any required variable is missing.