Haml Inherit Templates
- by kjfletch
I'm using Haml (Haml/Sass 3.0.9 - Classy Cassidy) stand-alone to generate static HTML. I want to create a shared layout template that all my other templates inherit.
Layout.haml
%html
%head
%title Test Template
%body
.Content
Content.haml
SOMEHOW INHERIT Layout.haml
SOMEHOW Change the title of the page "My Content".
%p This is my content
To produce:
Content.html
<html>
<head>
<title>My Content</title>
</head>
<body>
<div class="Content">
<p>This is my content</p>
</div>
</body>
</html>
But this doesn't seem possible. I have seen the use of rendering partials when using Haml with Rails but can't find any solution when using Haml stand-alone.
Having to put the layout code in all of my templates would be a maintenance nightmare; so my question is how do I avoid doing this? Is there a standard way to solve this problem? Have I missed something fundamental?