Skip to navigation Skip to main content
The possum is Eleventy’s mascot
Stable
3.0.0
Canary
3.0.1-alpha.5
Menu
Eleventy 5.81s
Remix 40.14s

Command Line Usage

Prerequisites
  1. Eleventy runs in a Terminal application. Well, wait—what is a Terminal?
  2. Have you already installed Eleventy?

Here’s the first command you can enter in your Terminal application to run Eleventy:

npm pnpm yarn
# Searches the current directory, outputs to ./_site
npx @11ty/eleventy

# `npx @11ty/eleventy` is the same as:
npx @11ty/eleventy --input=. --output=_site

Read more about --input and --output. Note that setting the input and output directories via config file is preferred.

A hypothetical template.md in the current directory would be rendered to _site/template/index.html. Read more at Permalinks.

npm pnpm yarn
# Use only a subset of template types
npx @11ty/eleventy --formats=md,html,ejs

# Don’t process any formats
npx @11ty/eleventy --formats=

# Find out the most up-to-date list of commands (there are more)
npx @11ty/eleventy --help
  • The default for --formats= changed in v3.0.0 from an alias of * to an empty set.

Re-run Eleventy when you save

Jump to section titled: Re-run Eleventy when you save
npm pnpm yarn
# Add a web server to apply changes and
# refresh automatically. We’ll also --watch for you.
npx @11ty/eleventy --serve

# Change the web server’s port—use localhost:8081
npx @11ty/eleventy --serve --port=8081

# Watch and re-run when files change, without the web server.
npx @11ty/eleventy --watch

--quiet if the Output is Too Noisy

Jump to section titled: --quiet if the Output is Too Noisy
npm pnpm yarn
# Shhhhh—Don’t log so much to the console
npx @11ty/eleventy --quiet

--dryrun to do a Little Testing

Jump to section titled: --dryrun to do a Little Testing

Runs without writing to the file system. Useful when debugging.

npm pnpm yarn
# Run Eleventy but don’t write any files
npx @11ty/eleventy --dryrun

--config to Change the Config file name

Jump to section titled: --config to Change the Config file name
npm pnpm yarn
# Override the default eleventy project config filename (.eleventy.js)
npx @11ty/eleventy --config=myeleventyconfig.js

Read more about Configuration files.

Added in v3.0.0If your specified --config file does not exist, Eleventy will throw an error.

--to can output JSON

Jump to section titled: --to can output JSON
npm pnpm yarn
# Output a JSON structure (does not write to the file system)
npx @11ty/eleventy --to=json

# Output a Newline Deliminated JSON structure (does not write to the file system)
npx @11ty/eleventy --to=ndjson

# Default behavior (Output to file system)
npx @11ty/eleventy --to=fs

Read more about ndjson.

--incremental for Partial Incremental Builds

Jump to section titled: --incremental for Partial Incremental Builds
npm pnpm yarn
# *Repeat* builds only operate on files that have changed
npx @11ty/eleventy --watch --incremental
npx @11ty/eleventy --serve --incremental

# Skip the initial full build with `--ignore-initial`
npx @11ty/eleventy --serve --incremental --ignore-initial

# Pass in a template path, watch/serve not required
# Added in v3.0.0
npx @11ty/eleventy --incremental=myfile.md

Read more about incremental builds. Related GitHub #3324

--ignore-initial to run Eleventy without an Initial Build Added in v2.0.0

Jump to section titled: --ignore-initial to run Eleventy without an Initial Build Added in v2.0.0

Be wary of any file changes that happened while Eleventy wasn’t running!

npm pnpm yarn
# Don’t build when Eleventy starts, only build on file changes
npx @11ty/eleventy --watch --ignore-initial
npx @11ty/eleventy --serve --ignore-initial

# Works great with Incremental
npx @11ty/eleventy --serve --incremental --ignore-initial

Using the Same Input and Output

Jump to section titled: Using the Same Input and Output

Yes, you can use the same input and output directories, like so:

npm pnpm yarn
# Parse and write Markdown to HTML, respecting directory structure.
npx @11ty/eleventy --input=. --output=. --formats=md
WARNING:
Careful with --formats=html here! If you run Eleventy more than once, we will attempt to process your new output files as input files (which will throw errors). Read more at the HTML template docs.

Other pages in Getting Started: