clean-up-svg-icons.sh 864 B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. # @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  3. # For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. # Cleans up and optimizes SVG files using the SVGO utility.
  5. # The configuration file is located in svgo.config.json.
  6. #
  7. # Usage:
  8. # yarn run clean-up-svg-icons path/to/icons/foo.svg
  9. #
  10. # To optimize the entire project:
  11. # yarn clean-up-svg-icons packages/**/theme/icons
  12. # A list of icons that should not NOT be cleaned up. Their internal structure should not be changed
  13. # because, for instance, CSS animations may depend on it.
  14. BLACKLIST=("return-arrow.svg")
  15. for i in "$@"
  16. do
  17. if [[ " ${BLACKLIST[@]} " =~ " $(basename $i) " ]]
  18. then
  19. echo "\x1B[33m[clean-up-svg-icons]\x1B[0m Note: \"$i\" is blacklisted, skipping."
  20. else
  21. svgo --config=./scripts/svgo.config.json -i $i
  22. fi
  23. done