Even keeping layout.erb and making a sublayout article_layout.haml causes a similar error when navigating to a blog article, while making an article_layout.erb works fine. I then suspected that only ERb files were being taken as layout files - which I confirmed by renaming layout.haml to layout.erb, which didn't cause an error but just displayed raw HAML code instead. = current_ || "The Middleman"Īt first I thought the error was only ocurring because the HAML itself was broken, but even a very simple HAML file that defines only doctype, html, head, title and body tags breaks. Layout.haml doesn't have quite the same content as layout.erb, but that doesn't seem to matter since it breaks no matter what: !!! System/Library/Frameworks/amework/Versions/2.0/usr/lib/ruby/2.0.0/webrick/server.rb: in block in start_thread System/Library/Frameworks/amework/Versions/2.0/usr/lib/ruby/2.0.0/webrick/httpserver.rb: in run Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb: in service Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/showexceptions.rb: in in call Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/urlmap.rb: in do |host, location, match, app|. Library/Ruby/Gems/2.0.0/gems/rack-1.5.2/lib/rack/urlmap.rb: in block in call Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.3/lib/middleman-core/core_extensions/request.rb: in call Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.3/lib/middleman-core/core_extensions/request.rb: in call! ![]() Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.3/lib/middleman-core/core_extensions/request.rb: in catch Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.3/lib/middleman-core/core_extensions/request.rb: in block in call! Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.3/lib/middleman-core/core_extensions/request.rb: in process_request Instrument 'render.resource', path: relative_source, destination_path: destination_path do. Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.3/lib/middleman-core/sitemap/resource.rb: in render Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.3/lib/middleman-core/sitemap/resource.rb: in instrumentĭelegate :logger, :instrument, to: :app. ![]() Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.3/lib/middleman-core/application.rb: in instrumentĭelegate :instrument, to: ::Middleman::Util. ::ActiveSupport::Notifications.instrument(suffixed_name, payload, &block). Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.3/lib/middleman-core/util.rb: in instrument Library/Ruby/Gems/2.0.0/gems/activesupport-4.1.4/lib/active_support/notifications.rb: in instrument Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.3/lib/middleman-core/sitemap/resource.rb: in block in renderĪpp.render_template(source_file, locs, opts, blocks). Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.3/lib/middleman-core/core_extensions/rendering.rb: in render_templateĬontent = render_individual_file(layout_path, locs, opts, context). Library/Ruby/Gems/2.0.0/gems/middleman-core-3.3.3/lib/middleman-core/core_extensions/rendering.rb: in render_individual_fileĬontent = template.render(context, locs, &block). Library/Ruby/Gems/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb: in render ![]() Library/Ruby/Gems/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb: in evaluate Library/Ruby/Gems/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb: in compiled_method Library/Ruby/Gems/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb: in compile_template_method Library/Ruby/Gems/2.0.0/gems/tilt-1.4.1/lib/tilt/erb.rb: in precompiled Template_encoding = extract_encoding(template). Library/Ruby/Gems/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb: in precompiled Library/Ruby/Gems/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb: in extract_encodingĮxtract_magic_comment(script) || script.encoding. Library/Ruby/Gems/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb: in extract_magic_comment Library/Ruby/Gems/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb: in binary String.force_encoding(original_encoding). Library/Ruby/Gems/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb: in ensure in binary Ruby /Library/Ruby/Gems/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb: in ensure in binary, line 289 Undefined method `force_encoding' for nil:NilClass ![]() Unfortunately, when I replace layout.erb with layout.haml, I get this error: NoMethodError at / I want to use HAML for my layouts since I'm trying to become familiar with it, so I decided to replace the default layout with a HAML version. I've been having trouble switching from a default layout.erb file to an equivalent layout.haml file in Middleman.
0 Comments
Leave a Reply. |