Created
December 23, 2013 19:13
-
-
Save chip/8102870 to your computer and use it in GitHub Desktop.
This helps me find unused images in a Rails project. The echo statement never executes, so there's a glitch, but the output was helpful nonetheless. I'll try to improve later.
This file contains hidden or 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/sh | |
PROJECT="" # Fill this in | |
IMAGES="$PROJECT/app/assets/images" | |
VIEWS="$PROJECT/app/views" | |
CSS="$PROJECT/app/assets/stylesheets" | |
for image in `find $IMAGES -type f` | |
do | |
name=`basename $image` | |
echo "Searching for $name [originally $image]" | |
if ! ag $name $VIEWS $CSS; then | |
echo "$image is not referenced" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment