image_optim icon indicating copy to clipboard operation
image_optim copied to clipboard

image_optim sprockets preprocessor fails at .webp image

Open thehappycoder opened this issue 9 years ago • 3 comments

$ RAILS_ENV=production rake assets:precompile
svgo worker: `svgo` not found; please provide proper binary or disable this worker (--no-svgo argument or `:svgo => false` through options)
rake aborted!
Sprockets::EncodingError: /Users/anton/pwork/utro/app/assets/images/sprites/1x/build/extra/extra-no-repeat-offset-x.png.webp has a invalid UTF-8 byte sequence
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/utils.rb:19:in `block (2 levels) in read_unicode'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/utils.rb:13:in `tap'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/utils.rb:13:in `block in read_unicode'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/utils.rb:12:in `open'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/utils.rb:12:in `open'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/utils.rb:12:in `read_unicode'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/context.rb:188:in `evaluate'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/processed_asset.rb:12:in `initialize'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/base.rb:374:in `new'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/base.rb:374:in `block in build_asset'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/base.rb:395:in `circular_call_protection'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/base.rb:373:in `build_asset'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/index.rb:94:in `block in build_asset'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/caching.rb:58:in `cache_asset'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/index.rb:93:in `build_asset'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/base.rb:287:in `find_asset'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/index.rb:61:in `find_asset'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/bundled_asset.rb:16:in `initialize'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/base.rb:377:in `new'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/base.rb:377:in `build_asset'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/index.rb:94:in `block in build_asset'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/caching.rb:58:in `cache_asset'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/index.rb:93:in `build_asset'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/base.rb:287:in `find_asset'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/index.rb:61:in `find_asset'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:211:in `block in find_asset'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:257:in `benchmark'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:210:in `find_asset'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:119:in `block in compile'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:118:in `each'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/sprockets/manifest.rb:118:in `compile'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:70:in `block (3 levels) in define'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-2.12.4/lib/rake/sprocketstask.rb:146:in `with_logger'
/Users/anton/.rvm/gems/ruby-2.2.3/gems/sprockets-rails-2.3.3/lib/sprockets/rails/task.rb:69:in `block (2 levels) in define'
/Users/anton/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
/Users/anton/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

When I disable it (config.assets.image_optim = false), all is fine.

thehappycoder avatar Jan 27 '16 17:01 thehappycoder

I've tried putting the first webp found in web without problems. Is it possible for you to share the image causing problems, or does it happen with any webp image?

toy avatar Jan 30 '16 14:01 toy

It choked on the first webp in my project. png, jpg files were ok extra-no-repeat-offset-x.png.webp.zip

thehappycoder avatar Feb 04 '16 16:02 thehappycoder

did you try?

npm install -g svgo

stevenbarragan avatar Oct 27 '16 23:10 stevenbarragan