First off, make sure you have all of the neccesary tools installed.
Even if you have them, it is a good idea to update them now:
# source: https://www.digitalocean.com/community/
# tutorials/how-to-install-node-js-on-ubuntu-18-04
# =========================================================
# check if any packages need update
sudo apt update
# install Nodejs
sudo apt insall nodejs
# install npm
sudo apt install npm
# check version of Nodejs
node -v
# check version of npm
npm -v
# source: https://treehouse.github.io/
# installation-guides/mac/node-mac.html
# ==========================================================
# check if any packages need update
brew update
# install Nodejs
brew install node
# check version of Nodejs
node -v
# check version of npm
npm -v
source: https://www.11ty.dev/docs/getting-started/
Go back to your local repo, switch to dev branch, and run npm init
You can answer yes to all questions. This will generate a file called package.js, which tells npm that
this folder is a project which will require various programs and tools to run. package.js
contains the name and version of those required program, as well as other settings for your project.
Now run npm install --save-dev @11ty/eleventy
This will install 11ty and record in package.js that this project requires 11ty to work.
Now, to the prompt. First create a directory called _includes. Create a file called
default.njk in the directory.
Files in the _include directory can be used as templates to speed up your development process. There are may things you can do with templates, but for now
we will stick with a simple example.
Paste the following code into default.njk:
<h1>
{{ content | safe }}
</h1>
where {{ content | safe }} will be replaced with the content of the webpage that uses this template. Now in the root directory, create a file called index.html and paste in the following code:
---
layout: default.njk
---
I am a plaintext
After you are done, use the following commands to run 11ty and convert the files you wrote into the final website.
# Run 11ty and build files into the final website.
# The generated website is stored in _site
npx @11ty/eleventy
# Run a local server to test your website
npx @11ty/eleventy --serve