Skip to content

Instantly share code, notes, and snippets.

@Neolot
Last active March 23, 2023 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Neolot/b643a171973f5ebd74c135da137539cc to your computer and use it in GitHub Desktop.
Save Neolot/b643a171973f5ebd74c135da137539cc to your computer and use it in GitHub Desktop.
SVG optimization in Nautilus with svgo
#!/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"
@Neolot
Copy link
Author

Neolot commented Mar 23, 2023

Create script and copy it to Nautilus scripts directory:

cp optimize_svg.sh ~/.local/share/nautilus/scripts/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment