├── README.md ├── install.sh ├── screenshots ├── 1.png └── 2.png └── svgo.applescript /README.md: -------------------------------------------------------------------------------- 1 | ## OS X Folder Action for SVGO, v0.0.1 2 | 3 | 1. install [SVGO](https://github.com/svg/svgo) 4 | 2. `curl -sS https://raw.githubusercontent.com/svg/svgo-osx-folder-action/master/install.sh | sh` 5 | 3. attach Folder Action to some folder: 6 | 7 | ![screenshot 1](https://raw.github.com/svg/svgo-osx-folder-action/master/screenshots/1.png) 8 | 9 | ![screenshot 2](https://raw.github.com/svg/svgo-osx-folder-action/master/screenshots/2.png) 10 | 11 | 4. drag-n-drop `.svg`-files to this folder 12 | 5. hurray, your files are optimized! 13 | 14 | ![](//mc.yandex.ru/watch/18561160) 15 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SCRIPTS_PATH="$HOME/Library/Scripts/Folder Action Scripts" 4 | 5 | mkdir -p "$SCRIPTS_PATH" 6 | curl -sSO https://raw.githubusercontent.com/svg/svgo-osx-folder-action/master/svgo.applescript 7 | osacompile -o "$SCRIPTS_PATH/svgo.scpt" svgo.applescript 8 | rm svgo.applescript 9 | -------------------------------------------------------------------------------- /screenshots/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svg/svgo-osx-folder-action/b53acb7f1b0625413b882cc51891bb9e12937d20/screenshots/1.png -------------------------------------------------------------------------------- /screenshots/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svg/svgo-osx-folder-action/b53acb7f1b0625413b882cc51891bb9e12937d20/screenshots/2.png -------------------------------------------------------------------------------- /svgo.applescript: -------------------------------------------------------------------------------- 1 | on adding folder items to this_folder after receiving these_items 2 | 3 | repeat with i from 1 to number of items in these_items 4 | 5 | set this_item to item i of these_items 6 | set the file_path to the POSIX path of this_item 7 | 8 | try 9 | do shell script "/bin/bash -l -c 'svgo \"" & file_path & "\"'" 10 | on error errStr number errorNumber 11 | display dialog "Error: " & errStr buttons {"OK"} with icon stop 12 | return number 13 | end try 14 | 15 | end repeat 16 | 17 | end adding folder items to 18 | --------------------------------------------------------------------------------