{"action":"created","issue":{"url":"https://api.github.com/repos/losttype/metalsmith-register-helpers/issues/1","labels_url":"https://api.github.com/repos/losttype/metalsmith-register-helpers/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/losttype/metalsmith-register-helpers/issues/1/comments","events_url":"https://api.github.com/repos/losttype/metalsmith-register-helpers/issues/1/events","html_url":"https://github.com/losttype/metalsmith-register-helpers/issues/1","id":90822792,"number":1,"title":"Unable to find helper","user":{"login":"jme783","id":4605360,"avatar_url":"https://avatars.githubusercontent.com/u/4605360?v=3","gravatar_id":"","url":"https://api.github.com/users/jme783","html_url":"https://github.com/jme783","followers_url":"https://api.github.com/users/jme783/followers","following_url":"https://api.github.com/users/jme783/following{/other_user}","gists_url":"https://api.github.com/users/jme783/gists{/gist_id}","starred_url":"https://api.github.com/users/jme783/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jme783/subscriptions","organizations_url":"https://api.github.com/users/jme783/orgs","repos_url":"https://api.github.com/users/jme783/repos","events_url":"https://api.github.com/users/jme783/events{/privacy}","received_events_url":"https://api.github.com/users/jme783/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-25T01:29:13Z","updated_at":"2016-01-12T01:21:29Z","closed_at":"2015-06-28T19:49:23Z","body":"Hi there,\r\n\r\nTrying to use your plugin but having some trouble having Handlebars recognize the helper I'm trying to register. I'm combining this with [metalsmith-templates](https://github.com/segmentio/metalsmith-templates) and hoping to register some helpers available in my `.hbs` files.\r\n\r\nHere is the error: \r\n```\r\nError: Missing helper: 'contains'\r\n    at new Error (<anonymous>)\r\n    at Error.Exception (/Users/Jeff/Documents/particle-apps/docs/node_modules/handlebars/dist/cjs/handlebars/exception.js:13:41)\r\n    at Object.<anonymous> (/Users/Jeff/Documents/particle-apps/docs/node_modules/handlebars/dist/cjs/handlebars/base.js:66:13)\r\n    at Object.eval (eval at <anonymous> (/Users/Jeff/Documents/particle-apps/docs/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js:171:23), <anonymous>:7:80)\r\n    at ret (/Users/Jeff/Documents/particle-apps/docs/node_modules/handlebars/dist/cjs/handlebars/runtime.js:137:30)\r\n    at ret (/Users/Jeff/Documents/particle-apps/docs/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js:422:21)\r\n    at Function.exports.handlebars.render (/Users/Jeff/Documents/particle-apps/docs/node_modules/metalsmith-templates/node_modules/consolidate/lib/consolidate.js:497:14)\r\n    at /Users/Jeff/Documents/particle-apps/docs/node_modules/metalsmith-templates/node_modules/consolidate/lib/consolidate.js:146:25\r\n    at /Users/Jeff/Documents/particle-apps/docs/node_modules/metalsmith-templates/node_modules/consolidate/lib/consolidate.js:99:5\r\n    at fs.js:272:14\r\n    at Object.oncomplete (fs.js:108:15)\r\n```\r\n\r\nHere is the relevant part of my `metalsmith.js` file:\r\n```\r\n    .use(helpers({\r\n      directory: '../templates/helpers'\r\n    }))\r\n    .use(templates({\r\n      engine: 'handlebars',\r\n      directory: '../templates'\r\n    }))\r\n```\r\n\r\nIn my `templates/helpers` directory, I have a file called `contains.js`:\r\n\r\n```\r\nmodule.exports = function( collection, item, options ){\r\n  // string check\r\n  if( typeof collection === 'string' ){\r\n    if( collection.search( item ) >= 0 ){\r\n      return options.fn(this);\r\n    }\r\n    else {\r\n      return options.inverse(this);\r\n    }\r\n  }\r\n  // \"collection\" check (objects & arrays)\r\n  for( var prop in collection ){\r\n    if( collection.hasOwnProperty( prop ) ){\r\n      if( collection[prop] == item ) return options.fn(this);\r\n    }\r\n  }\r\n  return options.inverse(this);\r\n};\r\n```\r\n\r\nand in my template:\r\n```\r\n  {{#contains path.href 'guide'}}\r\n    Contains guide!\r\n  {{else}}\r\n    nope\r\n  {{/contains}}\r\n```\r\n\r\nI would think that all of the pieces are in place to get this to work, but am having issues. Any ideas?"},"comment":{"url":"https://api.github.com/repos/losttype/metalsmith-register-helpers/issues/comments/170750891","html_url":"https://github.com/losttype/metalsmith-register-helpers/issues/1#issuecomment-170750891","issue_url":"https://api.github.com/repos/losttype/metalsmith-register-helpers/issues/1","id":170750891,"user":{"login":"kennethormandy","id":1581276,"avatar_url":"https://avatars.githubusercontent.com/u/1581276?v=3","gravatar_id":"","url":"https://api.github.com/users/kennethormandy","html_url":"https://github.com/kennethormandy","followers_url":"https://api.github.com/users/kennethormandy/followers","following_url":"https://api.github.com/users/kennethormandy/following{/other_user}","gists_url":"https://api.github.com/users/kennethormandy/gists{/gist_id}","starred_url":"https://api.github.com/users/kennethormandy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kennethormandy/subscriptions","organizations_url":"https://api.github.com/users/kennethormandy/orgs","repos_url":"https://api.github.com/users/kennethormandy/repos","events_url":"https://api.github.com/users/kennethormandy/events{/privacy}","received_events_url":"https://api.github.com/users/kennethormandy/received_events","type":"User","site_admin":false},"created_at":"2016-01-12T01:21:29Z","updated_at":"2016-01-12T01:21:29Z","body":"No, I think the issue was that we had a conflicting version of Handlebars listed as a dependency. This plugin works with Handlebars and Metalsmith, we are still using it."}}