Last active
December 14, 2019 10:14
-
-
Save jaydenseric/71727464b6ac0274eacb to your computer and use it in GitHub Desktop.
Find unused Sass variables via Terminal
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 | |
# Usage: | |
# 1. Save script in project. | |
# 2. Run "chmod +x find-unused-sass-variables.sh". | |
# 3. Run script, pointing to Sass directory: "./find-unused-sass-variables.sh ./scss". | |
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