I’ve come back to a middleman project after some time, maybe a year. I’ve loaded the latest Middleman (3.0.14). But now when I build, the ‘!!!’ at the top of layout.html.haml produces
<!DOCTYPE html>
instead of
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
as it used to.
HAML’s documentation says (at Haml::Options::format)
- format – Determines the output format. The default is :html5. The other options are :html4 and :xhtml. If the output is set to XHTML, then Haml automatically generates self-closing tags and wraps the output of the Javascript and CSS-like filters inside CDATA. When the output is set to :html5 or :html4, XML prologs are ignored. In all cases, an appropriate doctype is generated from !!!.
So how do I set Haml’s format to :xhtml in Middleman? In Rails, one apparently puts this in config/initializers/haml.rb
Haml::Template.options[:format] = :xhtml
But this doesn’t work in config.rb.