{"action":"opened","issue":{"url":"https://api.github.com/repos/SassDoc/sassdoc/issues/471","repository_url":"https://api.github.com/repos/SassDoc/sassdoc","labels_url":"https://api.github.com/repos/SassDoc/sassdoc/issues/471/labels{/name}","comments_url":"https://api.github.com/repos/SassDoc/sassdoc/issues/471/comments","events_url":"https://api.github.com/repos/SassDoc/sassdoc/issues/471/events","html_url":"https://github.com/SassDoc/sassdoc/issues/471","id":187359003,"number":471,"title":"Custom theme: Error: SassDocError: Given theme is [object Undefined], expected [object Undefined]","user":{"login":"makabde","id":801908,"avatar_url":"https://avatars.githubusercontent.com/u/801908?v=3","gravatar_id":"","url":"https://api.github.com/users/makabde","html_url":"https://github.com/makabde","followers_url":"https://api.github.com/users/makabde/followers","following_url":"https://api.github.com/users/makabde/following{/other_user}","gists_url":"https://api.github.com/users/makabde/gists{/gist_id}","starred_url":"https://api.github.com/users/makabde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/makabde/subscriptions","organizations_url":"https://api.github.com/users/makabde/orgs","repos_url":"https://api.github.com/users/makabde/repos","events_url":"https://api.github.com/users/makabde/events{/privacy}","received_events_url":"https://api.github.com/users/makabde/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-04T15:12:54Z","updated_at":"2016-11-04T15:12:54Z","closed_at":null,"body":"I started to work on a custom theme (with Handlebars as a theme engine).\r\nI am having issues when trying to run the `sassdoc` command from a gulp task. I am using the `ES6` notation for the `Gulpfile` and the theme `index` file but I have been facing the same issue for the last hours without any real luck to fix.\r\n\r\n```bash\r\n[15:16:19] Error: SassDocError: Given theme is [object Undefined], expected [object Undefined].\r\n    at formatError (~/.nvm/versions/node/v6.9.1/lib/node_modules/gulp-cli/lib/versioned/^4.0.0/formatError.js:20:10)\r\n    at Gulp.<anonymous> (~/.nvm/versions/node/v6.9.1/lib/node_modules/gulp-cli/lib/versioned/^4.0.0/log/events.js:30:15)\r\n    at emitOne (events.js:101:20)\r\n    at Gulp.emit (events.js:188:7)\r\n    at Object.error (~/Projects/opensource/sassdoc-theme-clear/node_modules/undertaker/lib/helpers/createExtensions.js:61:10)\r\n    at handler (~/Projects/opensource/sassdoc-theme-clear/node_modules/now-and-later/lib/mapSeries.js:43:14)\r\n    at f (~/Projects/opensource/sassdoc-theme-clear/node_modules/once/once.js:25:25)\r\n    at f (~/Projects/opensource/sassdoc-theme-clear/node_modules/once/once.js:25:25)\r\n    at done (~/Projects/opensource/sassdoc-theme-clear/node_modules/async-done/index.js:24:15)\r\n    at Domain.onError (~/Projects/opensource/sassdoc-theme-clear/node_modules/async-done/index.js:32:12)\r\n    at Domain.g (events.js:291:16)\r\n    at emitOne (events.js:96:13)\r\n    at Domain.emit (events.js:188:7)\r\n    at Domain.errorHandler [as _errorHandler] (domain.js:113:21)\r\n    at process._fatalException (bootstrap_node.js:293:33)\r\n```\r\n\r\nMy temporary gulp task:\r\n```js\r\ngulp.task('build:dev', done => {\r\n  let _stream = sassdoc(_config);\r\n\r\n  let _config = {\r\n    cache: false,\r\n    dest: path.resolve(__dirname, 'tmp'),\r\n    theme: path.resolve(__dirname, 'src'),\r\n    verbose: true\r\n  };\r\n\r\n  // gutil.log('Sassdoc config:\\n', _config);\r\n\r\n  gulp.src('src/scss/**/*.scss')\r\n    .pipe(_stream)\r\n    .on('end', () => {\r\n      gutil.log('End of parsing phase');\r\n    });\r\n\r\n  _stream.promise.then(\r\n    () => {\r\n      gutil.log('End of documentation process');\r\n      done();\r\n    },\r\n    (e) => {\r\n      gutil.log('error:' + e);\r\n    }\r\n  );\r\n});\r\n```\r\n\r\nAnd so far my index file looks like this\r\n```js\r\nimport def            from '../default';\r\n\r\nimport { Promise }    from 'bluebird';\r\nimport extend         from 'extend';\r\nimport fse            from 'fs-extra';\r\nimport Handlebars     from 'handlebars';\r\nimport path           from 'path';\r\nimport sassdocExtras  from 'sassdoc-extras';\r\n\r\nconst copy            = Promise.promisify(fse.copy);\r\nconst renderFile      = Promise.promisify(Handlebars.compile);\r\n\r\nconst applyDefaults = ctx => {\r\n  extend({}, def, ctx, {\r\n    display: extend(def.display, ctx.display),\r\n    groups: extend(def.groups, ctx.groups)\r\n  });\r\n};\r\n\r\nconst shortcutIcon = (dest, ctx) => {\r\n  if (!ctx.shortcutIcon) {\r\n    ctx.shortcutIcon = { type: 'internal', url: 'assets/images/favicon.png' };\r\n  } else if (ctx.shortcutIcon.type === 'internal') {\r\n    ctx.shortcutIcon.url = 'assets/images/' + ctx.shortcutIcon.url;\r\n\r\n    return () =>\r\n      copy(ctx.shortcutIcon.path, path.resolve(dest, ctx.shortcutIcon.url));\r\n  }\r\n};\r\n\r\nexport default (dest, ctx) => {\r\n  ctx = applyDefaults(ctx);\r\n\r\n  sassdocExtras(ctx,\r\n    'description',\r\n    'markdown',\r\n    'display',\r\n    'groupName',\r\n    'shortcutIcon',\r\n    'sort',\r\n    'resolveVariables'\r\n  );\r\n\r\n  ctx.data.byGroupAndType = sassdocExtras.byGroupAndType(ctx.data);\r\n\r\n  // Avoid key collision with Handlebars default `data`.\r\n  // @see https://github.com/SassDoc/generator-sassdoc-theme/issues/22\r\n  ctx._data = ctx.data;\r\n  delete ctx.data;\r\n\r\n  const index = path.resolve(__dirname, 'views/index.hbs');\r\n\r\n  let promises = [\r\n    copy(path.resolve(__dirname, '../assets'), path.resolve(dest, 'assets'))\r\n      .then(shortcutIcon(dest, ctx)),\r\n\r\n    renderFile(index, ctx)\r\n  ];\r\n\r\n  return Promise.all(promises);\r\n};\r\n```\r\n\r\n"}}
{"actor":{"display_login":"makabde"}}