Skip to content

Instantly share code, notes, and snippets.

@akaleeroy
Last active January 12, 2020 20:06
Show Gist options
  • Save akaleeroy/cf011d820b92f527044d2754821aa541 to your computer and use it in GitHub Desktop.
Save akaleeroy/cf011d820b92f527044d2754821aa541 to your computer and use it in GitHub Desktop.
OpenSCAD Export git pre-commit hook
#!/usr/bin/sh
# Requires OpenSCAD on $PATH
# Automatically re-exports all changed .scad files pre-commit
git diff --cached --name-only | grep ".scad$" | while read -r file; do
basename="${file%.*}"
echo "Exporting $file to $basename.stl..."
openscad -o "$basename.stl" "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment