title: Node.js with Handlebars.js on server and client
body: <p>I have an app in Node.js using Expressjs and Handlebars as the template engine.</p>
  
  <p>Expressjs uses layouts and then renders views.  The layout (layout.hbs) looks like this:</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html lang="en"&gt;
      &lt;head&gt;
      &lt;/head&gt;
    &lt;body&gt;
      {{{body}}}
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The <code>{{{body}}}</code> is replaced server-side, within node.js when you access a route.  For example:</p>
  
  <pre><code>app.get('/', function(req, res){
     res.render('index'})
  })
  </code></pre>
  
  <p>Will replace the <code>{{{body}}}</code> tag with the contents of index.hbs.</p>
  
  <p>Now, on the client side I'm using Backbone.js and want to use Handlebars for the views controlled via Backbone.  The problem is that because these pages are already rendered through Handlebars, when I attempt to use Handlebars within it (or Handlebars within Handlebars) it doesn't work.  There are no errors, it simply just doesn't replace tags with data.  </p>
  
  <p>Has anyone encountered this before or have any idea a work around?</p>
  
  <p>Thank you!</p>