Last active
January 26, 2021 13:42
-
-
Save guychouk/66db19badad9509b6edd0062fa35766a to your computer and use it in GitHub Desktop.
Post merge/pull hook to run npm command only if view files changed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
changedFiles="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
runOnChange() { | |
echo "$changedFiles" | grep -q "$1" && eval "$2" | |
} | |
runOnChange resources/js/ "npm run <your-npm-script>" | |
runOnChange resources/scss/ "npm run <your-npm-script>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment