Created
January 9, 2023 13:36
Bash script to find unused SCSS variables
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
#!/usr/bin/env bash | |
# HOW TO USE | |
# Save code to file | |
# Run as "SCRIPT_FILE_NAME SASS_DIRECTORY" | |
# e.g "./find_unused_scss_variables.sh ./sass" | |
VAR_NAME_CHARS='A-Za-z0-9_-' | |
find "$1" -type f -name "*.scss" -exec grep -o "\$[$VAR_NAME_CHARS]*" {} ';' | sort | uniq -u |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment