/**
 * Styleguidist config
 */

const path = require('path');
const environment = require('./config').story.environment;
const packageName = require('../../package.json').name;

const lookup_extension = 'jsx';
const stories_extension = 'story.md';
const stories_path = path.resolve(__dirname, '../../documents/stories');

module.exports = {
  title: `${packageName} Stories`,
  serverHost: environment.host,
  serverPort: environment.port,
  webpackConfig: require('./webpack.config.dev'),
  components: () => ([
    `../../src/components/**/*.${lookup_extension}`,
    `../../src/containers/**/components/*.${lookup_extension}`
  ]), // Where to look for components
  getExampleFilename: function(componentPath) {
    const filename = path.basename(componentPath, `.${lookup_extension}`);

    return path.join(`${stories_path}`, `${filename}.${stories_extension}`);
  },
  assetsDir: '../../public', // Assets folder
  styleguideDir: '../../public/story' // Build destination
};

@@ -55,16 +55,46 @@
 path');%0A
+const glob = require('glob');%0A
 const en
@@ -144,16 +144,16 @@
 onment;%0A
-
 const pa
@@ -201,16 +201,71 @@
 .name;%0A%0A
+const src_path = path.resolve(__dirname, '../../src');%0A
 const lo
@@ -592,78 +592,229 @@
  =%3E 
-(%5B
+%7B
 %0A    
-%60../../src/components/**/*.$%7Blookup_extension%7D%60,%0A    %60../../src
+// Find all components folder in src/components/**/*.jsx & src/containers/**/components/**/*.jsx%0A    const abs_path = glob.sync(%60$%7Bsrc_path%7D/components/**/*.$%7Blookup_extension%7D%60).concat(%0A      glob.sync(%60$%7Bsrc_path%7D
 /con
@@ -836,16 +836,19 @@
 onents/*
+*/*
 .$%7Blooku
@@ -864,13 +864,209 @@
 on%7D%60
+)
 %0A  
-%5D)
+  );%0A    // Turn absolute paths to relative path, which works with styleguide config%0A    const rel_path = abs_path.map(dir =%3E (%0A      path.relative(__dirname, dir)%0A    ));%0A%0A    return rel_path;%0A  %7D
 , //

fix multi components path in styleguidist config