Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save getnashty/4b86f42a4109fc4be68a04ee7ef9a078 to your computer and use it in GitHub Desktop.
Save getnashty/4b86f42a4109fc4be68a04ee7ef9a078 to your computer and use it in GitHub Desktop.
Short script which will grep your project for unused requirejs imports. Usage: `/path/to/file.sh application/js/directory`
#/bin/bash
JS_FILES=$(find "$1" -name "*.js")
for FILE in $JS_FILES; do
short_name=`basename $FILE`
filename="${short_name%.*}"
git grep --quiet $filename 1>/dev/null
if [ "$?" == "1" ]; then
echo "Should delete: $FILE"
fi
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment