Setting up the repo was easy and something I've done plenty.
No clue what this line does echo '# Page header' > [README.md](<http://readme.md/>)
so I'm going to run it and find out. Ahh that adds markdown to the README, which blew away the one I started. Undid that. Ohhhh, you do it so that you have content in there for the "eleventy" command, which creates an index.html and adds the info. So now, I have the guts of my original one in there.
npm init -y
is nice, in that it adds my real data. Sorry Zach, you are no longer the star of my package.json
echo
is not something I'm used to, but it's a fast way to get started.
I want to do things more cleanly, like I've seen in others and use src
for the input. Time for my own script, based on this from the docs:
# `npx @11ty/eleventy` is the same as:
npx @11ty/eleventy --input=. --output=_site
The old, lazy me would just update my alias with that but I want to add my own script to the package.json
. This would make more sense for anyone else as they wouldn't know that my aliases had the command.
"scripts": {
"dev": "npx @11ty/eleventy --input=. --output=_site --serve",
"test": "echo \\"Error: no test specified\\" && exit 1"
},
This site will go on Netlify to replace my current one and since deploy failures are top of mind, I want to get it up ASAP. I've never put anything on Netlify without a starter. I'm going to do something potentially wrong here. My old version and many sites I've seen use DEBUG=* eleventy
as the build script. I'll change it in the future when I understand why, but for now I'm going to try using only eleventy
to see if it works as I think it should.
My initial build failed when I set up from the Netlify UI but I expected that as main
doesn't have the setup that I've done. PRing to see if it works once I have it merged.
The build and deploy succeeded but didn't work as expected. When I set my command, I didn't add the --output=_site
because I thought it would stay as the default, but it looks like it picks up the input. So now, my index.html
went to /src
.
9:52:45 PM: $ eleventy
9:52:46 PM: Writing _site/README/index.html from ./README.md.
9:52:46 PM: Writing _site/src/index.html from ./src/index.html.
9:52:46 PM: Wrote 2 files in 0.15 seconds (v0.11.1)
Strike two
My package.json
has
"scripts": {
"build": "eleventy --input=src --output=_site --serve",
"dev": "npx @11ty/eleventy --input=src --output=_site --serve",
"test": "echo \\"Error: no test specified\\" && exit 1"
},
but it still outputs to src
. Back to the docs. This is interesting because locally it behaves differently. I get exactly what I expect locally, with src
outputting to _site