Unit 01 · lesson

`jekyll build`, `jekyll serve`, and the CLI

jekyll build, jekyll serve, and the CLI

You do not need to memorize every Jekyll option.

You do need to know how to read a command as an instruction to the build system.

Two commands, different intent

Build

bundle exec jekyll build

Purpose:

Produce the site output.

This is useful when you care about the generated files themselves, production builds, CI, or verifying that the source can build successfully.

Serve

bundle exec jekyll serve

Purpose:

Build the site and run a development server for local preview.

During development, serve is convenient because Jekyll can watch source changes and rebuild.

Live reload

The official tutorial also shows:

bundle exec jekyll serve --livereload

Live reload can refresh the browser when the site rebuilds.

Convenient? yes.

Proof that the build is correct? no.

Automation can make feedback faster. It does not remove the need to inspect the source, terminal, and generated result.

Read the command

Take:

bundle exec jekyll serve --livereload

Break it apart:

bundle exec     run inside the project's bundle
jekyll          invoke Jekyll
serve           use the serve command
--livereload    enable a serve option

Now the command is not a spell.

Inspect available help

Try:

bundle exec jekyll help

or command-specific help supported by your installed version.

Do not copy a random command-line flag from a five-year-old blog post without checking whether your version supports it.

Controlled experiment

  1. Run a normal build.
  2. Record whether the command exits or continues running.
  3. Run serve.
  4. Record whether the command exits or continues running.
  5. Identify the local address Jekyll reports.
  6. Stop the server intentionally.
  7. Attempt to refresh the browser.

Explain what changed when the Jekyll server process stopped even though _site files still existed.

That distinction prepares you for production later: generated files can exist independently of a running development server.

Read an error like evidence

If the requested port is already in use, do not immediately delete files.

The source may be perfectly fine.

The error concerns a server resource.

A strong troubleshooting note says:

The build layer may still be healthy. The serve command cannot bind the requested local port, so I will inspect the running process/port or choose an allowed alternate port.

That is systems reasoning applied to a web tool.

Checkpoint

Create a mini command reference in your own words:

bundle exec jekyll build
Use when:
What continues running afterward:
Evidence of success:

bundle exec jekyll serve
Use when:
What continues running afterward:
Evidence of success:

Keep it in the repository as notes or in your course evidence folder.