Skip to content

Instantly share code, notes, and snippets.

@jgillman
Created September 4, 2019 18:52
Show Gist options
  • Select an option

  • Save jgillman/62cc48896aced8cd25053145ade7b93e to your computer and use it in GitHub Desktop.

Select an option

Save jgillman/62cc48896aced8cd25053145ade7b93e to your computer and use it in GitHub Desktop.

Revisions

  1. jgillman created this gist Sep 4, 2019.
    15 changes: 15 additions & 0 deletions svgo_it.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    #!/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 "$@"