Skip to content

Instantly share code, notes, and snippets.

@sdrew
Forked from 50kudos/flashflush.sh
Last active August 29, 2015 14:23
Show Gist options
  • Save sdrew/1baa32f2352d9a066c68 to your computer and use it in GitHub Desktop.
Save sdrew/1baa32f2352d9a066c68 to your computer and use it in GitHub Desktop.
#!/bin/bash
cat $(find app/assets/stylesheets/ -type f) |
grep -Eo '\.[a-z]+[a-z0-9_-]*' | sort | uniq | sed s/.// |
while read CSS; do
if ! grep -Erqi "([^(remove|has)]class[(:|=|[:space:]*=>[:space:]*)]*\s*[(\"|')]*[-a-z0-9[:space:]]*$CSS|\\.$CSS\b)" app/views/ vendor/assets/ app/assets/javascripts/; then
echo $CSS >> unused.scss;
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment