Mixing template types

Is it possible to mix template types within Middleman? So for instance I have a layout.haml but could I use a index.html.erb view?

That should work.

(The index.html.erb will be rendered to pure html before yielded into the layout.haml.)

It does appear to work but looks like it’s having a problem with content_for blocks and mixed engines…

If is use this in layout.haml…

!!! 5
%html
  %head
    = yield_content(:stylesheet)
    %body
      = yield

and this in index.html.erb

<% content_for :stylesheet do %>
  <%= stylesheet_link_tag "hunters_two.css" %>
<% end %>

I get the following error…

NoMethodError at /
undefined method `concat' for nil:NilClass

Haml, in particular, has a bunch of content_for related headaches. I’d recommend Slim in its place.

However, you should be able to work around this by changing your content_for to the following:

<% content_for :stylesheet, stylesheet_link_tag "hunters_two.css" %>