Skip to content

Latest commit

 

History

History
107 lines (78 loc) · 3.21 KB

usage.md

File metadata and controls

107 lines (78 loc) · 3.21 KB
eleventyNavigation
parent key order
Getting Started
Command Line Usage
1

Command Line Usage

These examples assume local project installation instead of global installation.

# Searches the current directory, outputs to ./_site
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
eleventy

{% codewithprompt "npxeleventy", "last" %}

npx @11ty/eleventy is the same as:

--input=. --output=_site {% endcodewithprompt %}

Read more about --input and --output.

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

{% codewithprompt "npxeleventy", "last" %}

Use only a subset of template types

--formats=md,html,ejs {% endcodewithprompt %}

{% codewithprompt "npxeleventy", "last" %}

Find out the most up-to-date list of commands (there are more)

--help {% endcodewithprompt %}

Re-run Eleventy when you save

{% codewithprompt "npxeleventy", "last" %}

Boot up a Browsersync web server to apply changes and

refresh automatically. We’ll also --watch for you.

--serve {% endcodewithprompt %}

{% codewithprompt "npxeleventy", "last" %}

Change the web server’s port—use localhost:8081

--serve --port=8081 {% endcodewithprompt %}

{% callout "info" %}Important Note: Browsersync requires a <body> tag in your template for live-reload to work properly.{% endcallout %}

{% codewithprompt "npxeleventy", "last" %}

Automatically run when input template files change.

Useful if you have your own web server.

--watch {% endcodewithprompt %}

--quiet if the Output is Too Noisy

{% codewithprompt "npxeleventy", "last" %}

Shhhhh—Don’t log so much to the console

--quiet {% endcodewithprompt %}

--dryrun to do a Little Testing

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

{% codewithprompt "npxeleventy", "last" %}

Run Eleventy but don’t write any files

--dryrun {% endcodewithprompt %}

--config to Change the Config file name

{% codewithprompt "npxeleventy", "last" %}

Override the default eleventy project config filename (.eleventy.js)

--config=myeleventyconfig.js {% endcodewithprompt %}

Examples

Using the Same Input and Output

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

{% codewithprompt "npxeleventy", "last" %}

Parse and write Markdown to HTML, respecting directory structure.

--input=. --output=. --formats=md {% endcodewithprompt %}

{% callout "warn" %}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.{% endcallout %}