Skip to content

Instantly share code, notes, and snippets.

@steveherrin
Last active April 25, 2019 15:49
Show Gist options
  • Save steveherrin/eb688a0cf999f752ad7f9baf705200be to your computer and use it in GitHub Desktop.
Save steveherrin/eb688a0cf999f752ad7f9baf705200be to your computer and use it in GitHub Desktop.
Mermaid Makefile
SOURCES := $(shell find . -name '*.mmd' -not -path "node_modules")
SVGS := $(SOURCES:%.mmd=%.svg)
DATEFILE := .last_build.$(shell date +%Y-%m-%d).date
MERMAID_CLI := node_modules/.bin/mmdc
all: $(MERMAID_CLI) $(SVGS)
$(MERMAID_CLI): node_modules
node_modules: package.json
@npm install
%.svg: %.mmd $(DATEFILE)
$(MERMAID_CLI) -i $< -o $@
$(DATEFILE):
@rm -f .last_build.*.date
@touch $@
clean:
@rm -f $(SVGS)
@rm -f .last_build.*.date
cleaner: clean
@rm -rf node_modules
.PHONY: all clean cleaner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment