I have a middleman site that I deploy to netlify.
When I try to use middleman-imageoptim in the build process, it breaks on netlify's server. With that said, I can get a build to successfully complete locally on my mac.
It appears to be mutating the sitemap somehow, causing middleman-inliner to fail
config.rb:
###
# Page options, layouts, aliases and proxies
###
# Per-page layout changes:
#
# With no layout
page '/*.xml', layout: false
page '/*.json', layout: false
page '/*.txt', layout: false
set :fonts_dir, "fonts"
# With alternative layout
# page "/path/to/file.html", layout: :otherlayout
# Proxy pages (http://middlemanapp.com/basics/dynamic-pages/)
# proxy "/this-page-has-no-template.html", "/template-file.html", locals: {
# which_fake_page: "Rendering a fake page with a local variable" }
# General configuration
# Reload the browser automatically whenever files change
activate :sprockets
require 'inline_svg/action_view/helpers'
InlineSvg.configure do |config|
config.asset_finder = sprockets
end
helpers InlineSvg::ActionView::Helpers
if defined? RailsAssets
RailsAssets.load_paths.each do |path|
sprockets.append_path path
end
end
configure :development do
Slim::Engine.options[:pretty] = true
activate :livereload
end
###
# Helpers
###
# Methods defined in the helpers block are available in templates
# helpers do
# def some_helper
# "Helping"
# end
# end
# Build-specific configuration
activate :inliner
configure :build do
activate :favicon_maker, :icons => {
"_favicon_template.png" => [
{ icon: "apple-touch-icon-180x180-precomposed.png" }, # Same as apple-touch-icon-57x57.png, for iPhone 6 Plus with @3× display
{ icon: "apple-touch-icon-152x152-precomposed.png" }, # Same as apple-touch-icon-57x57.png, for retina iPad with iOS7.
{ icon: "apple-touch-icon-144x144-precomposed.png" }, # Same as apple-touch-icon-57x57.png, for retina iPad with iOS6 or prior.
{ icon: "apple-touch-icon-120x120-precomposed.png" }, # Same as apple-touch-icon-57x57.png, for retina iPhone with iOS7.
{ icon: "apple-touch-icon-114x114-precomposed.png" }, # Same as apple-touch-icon-57x57.png, for retina iPhone with iOS6 or prior.
{ icon: "apple-touch-icon-76x76-precomposed.png" }, # Same as apple-touch-icon-57x57.png, for non-retina iPad with iOS7.
{ icon: "apple-touch-icon-72x72-precomposed.png" }, # Same as apple-touch-icon-57x57.png, for non-retina iPad with iOS6 or prior.
{ icon: "apple-touch-icon-60x60-precomposed.png" }, # Same as apple-touch-icon-57x57.png, for non-retina iPhone with iOS7.
{ icon: "apple-touch-icon-57x57-precomposed.png" }, # iPhone and iPad users can turn web pages into icons on their home screen. Such link appears as a regular iOS native application. When this happens, the device looks for a specific picture. The 57x57 resolution is convenient for non-retina iPhone with iOS6 or prior. Learn more in Apple docs.
{ icon: "apple-touch-icon-precomposed.png", size: "57x57" }, # Same as apple-touch-icon.png, expect that is already have rounded corners (but neither drop shadow nor gloss effect).
{ icon: "apple-touch-icon.png", size: "57x57" }, # Same as apple-touch-icon-57x57.png, for "default" requests, as some devices may look for this specific file. This picture may save some 404 errors in your HTTP logs. See Apple docs
{ icon: "favicon-196x196.png" }, # For Android Chrome M31+.
{ icon: "favicon-160x160.png" }, # For Opera Speed Dial (up to Opera 12; this icon is deprecated starting from Opera 15), although the optimal icon is not square but rather 256x160. If Opera is a major platform for you, you should create this icon yourself.
{ icon: "favicon-96x96.png" }, # For Google TV.
{ icon: "favicon-32x32.png" }, # For Safari on Mac OS.
{ icon: "favicon-16x16.png" }, # The classic favicon, displayed in the tabs.
{ icon: "favicon.png", size: "16x16" }, # The classic favicon, displayed in the tabs.
{ icon: "favicon.ico", size: "64x64,32x32,24x24,16x16" }, # Used by IE, and also by some other browsers if we are not careful.
{ icon: "mstile-70x70.png", size: "70x70" }, # For Windows 8 / IE11.
{ icon: "mstile-144x144.png", size: "144x144" },
{ icon: "mstile-150x150.png", size: "150x150" },
{ icon: "mstile-310x310.png", size: "310x310" },
{ icon: "mstile-310x150.png", size: "310x150" }
]
}
activate :directory_indexes # Pretty URLs
activate :minify_css
activate :minify_javascript
activate :imageoptim do |options|
options.manifest = true
options.pngout = false
options.svgo = false
end
activate :asset_hash # Enable cache buster
activate :gzip
end
Stack Trace:
error build/demo/index.html
12:41:21 PM: undefined method `include?' for nil:NilClass
/opt/build/cache/bundle/ruby/2.3.0/bundler/gems/middleman-inliner-e57b7e1d47d6/lib/middleman-inliner.rb:12:in `block (2 levels) in inline_css'
/opt/build/cache/bundle/ruby/2.3.0/bundler/gems/middleman-inliner-e57b7e1d47d6/lib/middleman-inliner.rb:12:in `select'
/opt/build/cache/bundle/ruby/2.3.0/bundler/gems/middleman-inliner-e57b7e1d47d6/lib/middleman-inliner.rb:12:in `block in inline_css'
/opt/build/cache/bundle/ruby/2.3.0/bundler/gems/middleman-inliner-e57b7e1d47d6/lib/middleman-inliner.rb:10:in `map'
/opt/build/cache/bundle/ruby/2.3.0/bundler/gems/middleman-inliner-e57b7e1d47d6/lib/middleman-inliner.rb:10:in `inline_css'
layouts/layout.slim:41:in `block in singleton class'
layouts/layout.slim:-5:in `instance_eval'
layouts/layout.slim:-5:in `singleton class'
layouts/layout.slim:-7:in `__tilt_19116300'
/opt/build/cache/bundle/ruby/2.3.0/gems/tilt-2.0.6/lib/tilt/template.rb:161:in `call'
/opt/build/cache/bundle/ruby/2.3.0/gems/tilt-2.0.6/lib/tilt/template.rb:161:in `evaluate'
/opt/build/cache/bundle/ruby/2.3.0/gems/tilt-2.0.6/lib/tilt/template.rb:100:in `render'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/renderers/slim.rb:6:in `render'
/opt/build/cache/bundle/ruby/2.3.0/gems/padrino-helpers-0.13.3.3/lib/padrino/rendering.rb:17:in `render'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/file_renderer.rb:79:in `render'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/template_renderer.rb:157:in `block in render'
/opt/build/cache/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_support/notifications.rb:166:in `instrument'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/util.rb:21:in `instrument'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/template_renderer.rb:156:in `render'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/sitemap/resource.rb:154:in `render'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/rack.rb:112:in `process_request'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/rack.rb:66:in `block in call'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/rack.rb:65:in `catch'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/rack.rb:65:in `call'
/opt/build/cache/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/urlmap.rb:68:in `block in call'
/opt/build/cache/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/urlmap.rb:53:in `each'
/opt/build/cache/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/urlmap.rb:53:in `call'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/extensions/minify_javascript.rb:55:in `call'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/extensions/minify_css.rb:63:in `call'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/core_extensions/inline_url_rewriter.rb:74:in `call'
/opt/build/cache/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/head.rb:12:in `call'
/opt/build/cache/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/lint.rb:49:in `_call'
/opt/build/cache/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/lint.rb:37:in `call'
/opt/build/cache/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:153:in `call'
/opt/build/cache/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/mock.rb:74:in `request'
/opt/build/cache/bundle/ruby/2.3.0/gems/rack-2.0.1/lib/rack/mock.rb:56:in `get'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/builder.rb:232:in `block in output_resource'
/opt/build/cache/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_support/notifications.rb:166:in `instrument'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/util.rb:21:in `instrument'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/builder.rb:225:in `output_resource'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
/opt/build/cache/bundle/ruby/2.3.0/gems/parallel-1.11.1/lib/parallel.rb:482:in `call_with_index'
/opt/build/cache/bundle/ruby/2.3.0/gems/parallel-1.11.1/lib/parallel.rb:453:in `process_incoming_jobs'
/opt/build/cache/bundle/ruby/2.3.0/gems/parallel-1.11.1/lib/parallel.rb:435:in `block in worker'
/opt/build/cache/bundle/ruby/2.3.0/gems/parallel-1.11.1/lib/parallel.rb:426:in `fork'
/opt/build/cache/bundle/ruby/2.3.0/gems/parallel-1.11.1/lib/parallel.rb:426:in `worker'
/opt/build/cache/bundle/ruby/2.3.0/gems/parallel-1.11.1/lib/parallel.rb:417:in `block in create_workers'
/opt/build/cache/bundle/ruby/2.3.0/gems/parallel-1.11.1/lib/parallel.rb:416:in `each'
/opt/build/cache/bundle/ruby/2.3.0/gems/parallel-1.11.1/lib/parallel.rb:416:in `each_with_index'
/opt/build/cache/bundle/ruby/2.3.0/gems/parallel-1.11.1/lib/parallel.rb:416:in `create_workers'
/opt/build/cache/bundle/ruby/2.3.0/gems/parallel-1.11.1/lib/parallel.rb:358:in `work_in_processes'
/opt/build/cache/bundle/ruby/2.3.0/gems/parallel-1.11.1/lib/parallel.rb:264:in `map'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/builder.rb:137:in `output_resources'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/builder.rb:131:in `output_files'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/builder.rb:71:in `block in run!'
/opt/build/cache/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_support/notifications.rb:166:in `instrument'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/util.rb:21:in `instrument'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/builder.rb:70:in `run!'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/method_reference.rb:43:in `send_to'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/call_with.rb:76:in `call_with'
/opt/build/cache/bundle/ruby/2.3.0/gems/contracts-0.13.0/lib/contracts/method_handler.rb:138:in `block in redefine_method'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-cli-4.2.1/lib/middleman-cli/build.rb:80:in `block in build'
/opt/build/cache/bundle/ruby/2.3.0/gems/activesupport-5.0.2/lib/active_support/notifications.rb:166:in `instrument'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-core-4.2.1/lib/middleman-core/util.rb:21:in `instrument'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-cli-4.2.1/lib/middleman-cli/build.rb:79:in `build'
/opt/build/cache/bundle/ruby/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
/opt/build/cache/bundle/ruby/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
/opt/build/cache/bundle/ruby/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:133:in `block in invoke_all'
/opt/build/cache/bundle/ruby/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:133:in `each'
/opt/build/cache/bundle/ruby/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:133:in `map'
/opt/build/cache/bundle/ruby/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:133:in `invoke_all'
/opt/build/cache/bundle/ruby/2.3.0/gems/thor-0.19.4/lib/thor/group.rb:232:in `dispatch'
/opt/build/cache/bundle/ruby/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:115:in `invoke'
/opt/build/cache/bundle/ruby/2.3.0/gems/thor-0.19.4/lib/thor.rb:40:in `block in register'
/opt/build/cache/bundle/ruby/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
/opt/build/cache/bundle/ruby/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
/opt/build/cache/bundle/ruby/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
/opt/build/cache/bundle/ruby/2.3.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
/opt/build/cache/bundle/ruby/2.3.0/gems/middleman-cli-4.2.1/bin/middleman:70:in `<top (required)>'
/opt/build/cache/bundle/ruby/2.3.0/bin/middleman:22:in `load'
/opt/build/cache/bundle/ruby/2.3.0/bin/middleman:22:in `<main>'
/cc @netlify @bdougie
I have a middleman site that I deploy to netlify.
When I try to use
middleman-imageoptimin the build process, it breaks on netlify's server. With that said, I can get a build to successfully complete locally on my mac.It appears to be mutating the sitemap somehow, causing
middleman-inlinerto failconfig.rb:
Stack Trace:
/cc @netlify @bdougie