Last active
March 23, 2023 00:36
-
-
Save Neolot/b643a171973f5ebd74c135da137539cc to your computer and use it in GitHub Desktop.
SVG optimization in Nautilus with svgo
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/bash | |
if ! command -v svgo &> /dev/null; then | |
echo "SVGO is not installed. Install it by running 'npm install -g svgo'" | |
exit 1 | |
fi | |
for file in "$@"; do | |
if [ -f "$file" ]; then | |
extension="${file##*.}" | |
if [ "$extension" == "svg" ]; then | |
echo "File optimization: $file" | |
svgo "$file" | |
else | |
echo "Skip file: $file (not SVG)" | |
fi | |
fi | |
done | |
echo "Optimization completed" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Create script and copy it to Nautilus scripts directory:
cp optimize_svg.sh ~/.local/share/nautilus/scripts/