title: Handlebars helper: Compile template and keep @root
body: <p>I'm using grunt-compile-handlebars to compile my handlebars and I have the problem, that the <code>@root</code> object changes after I use</p>
  
  <pre><code>[...]
  handlebars.compile(template);
  template(context.data);
  [...]
  </code></pre>
  
  <p>So when my json object is something like</p>
  
  <pre><code>{
      "template": "path/to/template",
      "data": {
          "greetings": {...}
      }
   }
  </code></pre>
  
  <p>this is always my <code>@root</code> object.</p>
  
  <p>I have something like:</p>
  
  <pre><code>var handlebars = require('../../node_modules/grunt-compile-handlebars/node_modules/handlebars')     ;
  
  module.exports = function(context) {
  
      var template = handlebars.partials[context.template];
  
      template = handlebars.compile(template);
  
      return new handlebars.SafeString( template(context.data) );
  
  };
  {{helper .}}
  </code></pre>
  
  <p>Now my <code>@root</code> object is:</p>
  
  <pre><code>"data": {
      "greetings": {...}
  }
  </code></pre>
  
  <p>Is there a way I can preserve the <code>@root</code> when calling <code>template(...)</code></p>
  
  <p>Note: This is a very simplified example. I know that I also could use <code>{{&gt;path/to/template .}}</code></p>