title: How to do template inheritence with Sinatra and Slim?
body: <p>Using Sinatra and Slim, how can I do template inheritance? I can't find an answer on Google and the documentation on Slim is sparse. Let's say I have the following files:</p>
  
  <p><strong>main.rb</strong></p>
  
  <pre><code># Sinatra app
  get '/login' do
     slim :login
  end
  
  get '/display' do
     slim :display
  end
  </code></pre>
  
  <p><strong>layout.slim</strong></p>
  
  <pre><code>html
      body 
          == yield
  </code></pre>
  
  <p><strong>sub_layout.slim</strong></p>
  
  <pre><code>div[id="parent_div"]
      div[id="child_div"]
         h3 Rendering content
         == yield
         p display.slim should be rendered in == yield
  
      div[id="child_div"]
         h1 Rendering stuff in sublayout
         p Hello this div should go underneath the above div.
  </code></pre>
  
  <p><strong>login.slim</strong></p>
  
  <pre><code>p Welcome to the login page
  </code></pre>
  
  <p><strong>display.slim</strong></p>
  
  <pre><code>p Welcome to the display page
  </code></pre>
  
  <p>By default, Slim will use <strong>layout.slim</strong> as the base, so it will be automatically inherited when rendering the login and display templates. </p>
  
  <p>However, I want <strong>display.slim</strong> to inherit from <strong>sub_layout.slim</strong>, which in turn inherits <strong>layout.slim</strong>. <strong>login.slim</strong> will inherit directly from <strong>layout.slim</strong>, which is the default behavior so this is fine.</p>
  
  <p>How can I do this with Sinatra and Slim?</p>