Stand with Ukraine 🇺🇦
The possum is Eleventy’s mascot

Eleventy Documentation

This is an older version of Eleventy. Go to the newest Eleventy docs (current path: /docs/usage/) or the full release history.

Command Line Usage Jump to heading

These examples assume local project installation instead of global installation.

# Searches the current directory, outputs to ./_site
npx @11ty/eleventy
Make sure you always use npx @11ty/eleventy (including the @11ty/ prefix!). If you do not include the @11ty/ prefix and you don’t already have Eleventy installed (locally or globally), it will execute the wrong package. For consistency and accuracy always use npx @11ty/eleventy.

If you’re using a global install of Eleventy, remove npx @11ty/ from the beginning of each command, like so:

# Global installation
# `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 a config file is more reliable, especially when using tools like netlify dev.

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

# Use only a subset of template types
npx @11ty/eleventy --formats=md,html,ejs
# Find out the most up-to-date list of commands (there are more)
npx @11ty/eleventy --help

Re-run Eleventy when you save Jump to heading

# Boot up a Browsersync 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
Important Note: Browsersync requires a <body> tag in your template for live-reload to work properly.
# Automatically run when input template files change.
# Useful if you have your own web server.
npx @11ty/eleventy --watch

--quiet if the Output is Too Noisy Jump to heading

# Shhhhh—Don’t log so much to the console
npx @11ty/eleventy --quiet

--dryrun to do a Little Testing Jump to heading

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

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

--config to Change the Config file name Jump to heading

# Override the default eleventy project config filename (.eleventy.js)
npx @11ty/eleventy --config=myeleventyconfig.js

--to can output JSON Added in v1.0.0 Jump to heading

# 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 heading

# *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

Read more about incremental builds.

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

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

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

Using the Same Input and Output Jump to heading

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

# Parse and write Markdown to HTML, respecting directory structure.
npx @11ty/eleventy --input=. --output=. --formats=md
Careful with --formats=html here! If you run eleventy more than once, it’ll try to process the output files too. Read more at the HTML template docs.

Other pages in Getting Started: