Skip to content

Instantly share code, notes, and snippets.

@dettmering
Created July 11, 2019 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dettmering/17143518510cb06a087f5d449bfd8c35 to your computer and use it in GitHub Desktop.
Save dettmering/17143518510cb06a087f5d449bfd8c35 to your computer and use it in GitHub Desktop.
draw.io: Export all .drawio files in folder to PDF and PNG while preserving history. Very useful as a post-commit hook.
#!/bin/bash
rm -f *.pdf
rm -f *.png
COMMIT=$(git rev-parse HEAD)
for f in *.drawio
do
/Applications/draw.io.app/Contents/MacOS/draw.io --export --all-pages --output $f.pdf $f
/Applications/draw.io.app/Contents/MacOS/draw.io --export --all-pages --output $f.png $f
cp $f.pdf history/$f.${COMMIT::8}.pdf
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment