{"action":"created","issue":{"url":"https://api.github.com/repos/assemble/assemble/issues/647","labels_url":"https://api.github.com/repos/assemble/assemble/issues/647/labels{/name}","comments_url":"https://api.github.com/repos/assemble/assemble/issues/647/comments","events_url":"https://api.github.com/repos/assemble/assemble/issues/647/events","html_url":"https://github.com/assemble/assemble/issues/647","id":58576058,"number":647,"title":"v0.6.0 assemble pollutes my data object","user":{"login":"agross","id":16245,"avatar_url":"https://avatars.githubusercontent.com/u/16245?v=3","gravatar_id":"","url":"https://api.github.com/users/agross","html_url":"https://github.com/agross","followers_url":"https://api.github.com/users/agross/followers","following_url":"https://api.github.com/users/agross/following{/other_user}","gists_url":"https://api.github.com/users/agross/gists{/gist_id}","starred_url":"https://api.github.com/users/agross/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agross/subscriptions","organizations_url":"https://api.github.com/users/agross/orgs","repos_url":"https://api.github.com/users/agross/repos","events_url":"https://api.github.com/users/agross/events{/privacy}","received_events_url":"https://api.github.com/users/agross/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-02-23T11:50:47Z","updated_at":"2015-02-23T13:50:08Z","closed_at":null,"body":"In my first handlebars template I want to output all key/value pairs for my custom `data` object. The loader saves the object as `template.data.product` and it looks roughly like this:\r\n\r\n```js\r\n{\r\n  \"path\": \"source\\\\data\\\\1958\\\\DE\\\\8309.json\",\r\n  \"data\": {\r\n    \"product\": {\r\n      \"id\": 8309,\r\n      \"groupId\": 384,\r\n      \"imageId\": 181,\r\n      \"number\": \"RO-1\"\r\n    },\r\n    \"layout\": \"product\",\r\n    \"src\": {\r\n      // ...\r\n    },\r\n    \"dest\": {\r\n      // ...\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nHandlebars:\r\n```hbs\r\n<html>\r\n  <h1>{{product.desc1}}</h1>\r\n  <table>\r\n    <thead>\r\n      <td>Key</td>\r\n      <td>Value</td>\r\n    </thead>\r\n    {{#each product}}\r\n      <tr>\r\n        <td>{{@key}}</td>\r\n        <td>{{this}}</td>\r\n      </tr>\r\n    {{/each}}\r\n  </table>\r\n</html>\r\n\r\n```\r\n\r\nNow when it's time to render the layout template with this object, `data.product` suddenly contains extra properties `data.product.defaultLayout`, `data.product.src`, `data.product.dest`, and `data.product.layoutDelims`:\r\n\r\n```js\r\n{\r\n  \"path\": \"source\\\\data\\\\1958\\\\DE\\\\8309.json\",\r\n  \"data\": {\r\n    \"product\": {\r\n      \"id\": 8309,\r\n      \"groupId\": 384,\r\n      \"imageId\": 181,\r\n      \"number\": \"RO-1\",\r\n      \"defaultLayout\": false,\r\n      \"src\": {\r\n        \"dirname\": \"source\\\\layouts\",\r\n        \"basename\": \"product.hbs\",\r\n        // ...\r\n        \"path\": \"source/layouts/product.hbs\",\r\n        \"ext\": \".hbs\"\r\n      },\r\n      \"dest\": {\r\n        \"dirname\": \"source\\\\layouts\",\r\n        // ...\r\n      },\r\n      \"layoutDelims\": [\r\n        \"{%\",\r\n        \"%}\"\r\n      ]\r\n    },\r\n    \"layout\": \"product\",\r\n    \"src\": {\r\n      // ...\r\n    },\r\n    \"dest\": {\r\n      // ...\r\n    }\r\n  }\r\n}\r\n```\r\n\r\nI  checked with the debugger, these extra properties were added somewhere later in the pipeline than [`template.render(locals, function(err, content)`](https://github.com/assemble/template-render/blob/master/index.js#L75) and before [`Template.prototype.compileTemplate`](https://github.com/jonschlinkert/template/blob/master/index.js#L1695)."},"comment":{"url":"https://api.github.com/repos/assemble/assemble/issues/comments/75543290","html_url":"https://github.com/assemble/assemble/issues/647#issuecomment-75543290","issue_url":"https://api.github.com/repos/assemble/assemble/issues/647","id":75543290,"user":{"login":"jonschlinkert","id":383994,"avatar_url":"https://avatars.githubusercontent.com/u/383994?v=3","gravatar_id":"","url":"https://api.github.com/users/jonschlinkert","html_url":"https://github.com/jonschlinkert","followers_url":"https://api.github.com/users/jonschlinkert/followers","following_url":"https://api.github.com/users/jonschlinkert/following{/other_user}","gists_url":"https://api.github.com/users/jonschlinkert/gists{/gist_id}","starred_url":"https://api.github.com/users/jonschlinkert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonschlinkert/subscriptions","organizations_url":"https://api.github.com/users/jonschlinkert/orgs","repos_url":"https://api.github.com/users/jonschlinkert/repos","events_url":"https://api.github.com/users/jonschlinkert/events{/privacy}","received_events_url":"https://api.github.com/users/jonschlinkert/received_events","type":"User","site_admin":false},"created_at":"2015-02-23T13:50:08Z","updated_at":"2015-02-23T13:50:08Z","body":"Also, to clarify something, when you look at the `data` object at runtime, you're not just seeing the template's `data` object, you're looking at the `context`, which is built up in the `mergeContext` function using data from:\r\n-  `assemble.cache.data` (think of this as \"global\" or project-wide data), \r\n- `template.data`, data defined on the template itself. Unless it's extended directly or you're using virtual templates, this is usually front-matter.\r\n- `template.options`: which are used to pass options to template engines and similar libs.\r\n- `template.locals`: this is an object defined on an template method. \r\n\r\n"}}