Skip to content

Commit 96b4fe3

Browse files
authored
Add a Makefile for Ruby/bundle/Jekyll commands that I always forget. (#551)
I can never remember how to build the pages. Perhaps `make` helps? Certainly, it will positively affect all the carbon I'm wasting by Googling this: Every. Single. Time. With no arguments it shows help: ```sh ❯ make help Show this help serve Start a local server and serve the site build Build the site install Pull all jekyll dependencies clean Remove build files check Check ruby (bundle) is installed ``` And `make serve` does what 90% of developers are going to want for checking local changes. Inspired by (and a little bit stolen from) @t-young31 and @milanmlft (who are both very cool).
1 parent 046b0b9 commit 96b4fe3

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,9 @@ Pages all live in the `docs/pages` sub-directory, and are written in markdown.
7575
To build the webpage locally (for testing)
7676

7777
1. [Install jekyll]
78-
2. Run `bundle install` from the `docs/` directory of this repository to
79-
install dependencies.
80-
3. Run `bundle exec jekyll serve` from the root directory of this repository.
81-
This should fire up a local web server and tell you its address. By default
82-
the server will automatically refresh the HTML pages if any changes are made
78+
2. Run `make serve` from the `docs/` directory of this repository to
79+
install dependencies and start a local web server.
80+
The server will automatically refresh the HTML pages if any changes are made
8381
to the markdown sources.
8482

8583
See the [jekyll docs] for more info.

docs/Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
SHELL := /bin/bash
2+
.PHONY: help serve build install clean check
3+
4+
help: ## Show this help
5+
@echo
6+
@grep -E '^[a-zA-Z_0-9-]+:.*?## .*$$' $(MAKEFILE_LIST) \
7+
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%s\033[0m|%s\n", $$1, $$2}' \
8+
| column -t -s '|'
9+
@echo
10+
11+
serve: install ## Start a local server and serve the site
12+
bundle exec jekyll serve
13+
14+
build: install ## Build the site
15+
bundle exec jekyll build
16+
17+
install: check ## Pull all jekyll dependencies
18+
bundle install
19+
20+
clean: ## Remove build files
21+
rm -rf _site
22+
23+
check: ## Check ruby (bundle) is installed
24+
@command -v bundle &> /dev/null || { echo >&2 "Please install ruby >= 2.7 to use Jekyll"; exit 1; }

0 commit comments

Comments
 (0)