Sha256: b1b67417e49337ca46d724ca99513987b1061ca953fc8203eab178685df40577
Contents?: true
Size: 847 Bytes
Versions: 3
Compression:
Stored size: 847 Bytes
Contents
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 TIMEOUT_OPTION = timeout_option def optimize(src, dst) 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) && optimized?(src, dst) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
discourse_image_optim-0.26.1 | lib/image_optim/worker/svgo.rb |
discourse_image_optim-0.24.5 | lib/image_optim/worker/svgo.rb |
discourse_image_optim-0.24.4 | lib/image_optim/worker/svgo.rb |