Files
releases/docs/Makefile
T
David Boles 91d98c7205 docs: Add live-editable code blocks to the docs.
This commit adds a postprocessor to the docs build that enables
examples to be edited and have the results show up live. See the
additions to `docs/README.md` for more about what writing these
blocks looks like or the netlify PR preview
(e.g. at `docs/edge/how-do-i-write-policies/`)
to see them in action (you'll need to disable CORS for live output).

Signed-off-by: David Boles <me@davidbol.es>
2019-08-21 10:12:49 -07:00

79 lines
1.6 KiB
Makefile

.PHONY: clean
clean:
rm -rf ${CURDIR}/website/data/releases.yaml
rm -rf $(CURDIR)/website/generated
rm -rf $(CURDIR)/website/public
rm -rf $(CURDIR)/website/resources
.PHONY: generate
generate:
$(CURDIR)/website/scripts/load-docs.sh
.PHONY: setup
setup:
npm install
.PHONY: hugo-serve
hugo-serve:
hugo \
server \
--source $(CURDIR)/website \
--contentDir generated \
--buildDrafts \
--buildFuture
.PHONY: serve
serve: production-build
# must be run from root of repo for
# the netlify.toml config to work
cd $(CURDIR)/.. && netlify dev --offline
.PHONY: docker-serve
docker-serve:
docker run --rm -it \
-v $(CURDIR)/:/src \
-p 1313:1313 \
klakegg/hugo:0.55.5-ext server \
--source /src/website \
--contentDir generated
.PHONY: production-build
production-build: clean generate
hugo \
--source $(CURDIR)/website \
--contentDir generated \
--ignoreCache \
--minify
make live-blocks-inject
.PHONY: preview-build
preview-build: clean generate
hugo \
--source $(CURDIR)/website \
--contentDir generated \
--baseURL $(DEPLOY_PRIME_URL) \
--buildDrafts \
--buildFuture \
--ignoreCache \
--minify
make live-blocks-inject
.PHONY: linkcheck-build
linkcheck-build:
hugo \
--source $(CURDIR)/website \
--contentDir generated \
--baseURL "/" \
--buildDrafts \
--buildFuture
.PHONY: linkcheck
linkcheck: clean generate linkcheck-build
htmlproofer ./public --empty-alt-ignore
# The live-blocks-% pattern target will shim to the
# npm scripts in ./website/scripts/live-blocks
.PHONY: live-blocks-%
live-blocks-%:
cd $(CURDIR)/website/scripts/live-blocks && npm run --silent $*