Skip to content

Instantly share code, notes, and snippets.

@dcousens
Last active September 13, 2023 06:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcousens/8b3889a1cad98c14d51908ea89f0ff96 to your computer and use it in GitHub Desktop.
Save dcousens/8b3889a1cad98c14d51908ea89f0ff96 to your computer and use it in GitHub Desktop.
A generic D2 to SVG Makefile
# a generic D2 to SVG Makefile
.PHONY: clean watch
SRC = $(shell find . -name '*.d2')
SVGs = $(patsubst %.d2, %.svg, $(SRC))
build: $(SVGs)
%.svg: %.d2
d2 $< $@
watch:
while inotifywait -e modify .; do
make build
done
clean:
rm -f $(SVGs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment