Sha256: ffae6be69d150ef7d5121c31b56b69ae6730ea947ef6d4306e4d0c58a52d9364
Contents?: true
Size: 861 Bytes
Versions: 5
Compression:
Stored size: 861 Bytes
Contents
# frozen_string_literal: true require 'image_optim/worker' class ImageOptim class Worker # https://github.com/svg/svgo class Svgo < Worker DISABLE_PLUGINS_OPTION = option(:disable_plugins, [], 'List of plugins to disable') do |v| Array(v).map(&:to_s) end ENABLE_PLUGINS_OPTION = option(:enable_plugins, [], 'List of plugins to enable') do |v| Array(v).map(&:to_s) end def optimize(src, dst, options = {}) args = %W[ --input #{src} --output #{dst} ] disable_plugins.each do |plugin_name| args.unshift "--disable=#{plugin_name}" end enable_plugins.each do |plugin_name| args.unshift "--enable=#{plugin_name}" end execute(:svgo, args, options) && optimized?(src, dst) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems