Skip to content

Instantly share code, notes, and snippets.

@justinabrahms
Created May 29, 2013 20:05
Show Gist options
  • Save justinabrahms/5673408 to your computer and use it in GitHub Desktop.
Save justinabrahms/5673408 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