Skip to content

Instantly share code, notes, and snippets.

@jgillman
Created September 4, 2019 18:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgillman/62cc48896aced8cd25053145ade7b93e to your computer and use it in GitHub Desktop.
Save jgillman/62cc48896aced8cd25053145ade7b93e to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Automatically optimize and inline ALL styles
# svgo_it.sh my.svg
main() {
local input=$1
local precision=${2:-2}
# Move ALL styles to inline
local config='{ "plugins": [{ "inlineStyles": { "onlyMatchedOnce": false } }] }'
svgo -i "$input" -o "${input}.opt.svg" --precision="$precision" --multipass --config="$config"
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment