aboutsummaryrefslogtreecommitdiffstats
path: root/.ng2-component-lab/lab-configuration.module.ts
blob: d9305ddf6b187dbc89cd63fcdddc84c878c18844 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { createLab } from '@islavi/ng2-component-lab';
import { ComponentsModule } from './../stories/ng2-component-lab/components.module';

const themeName:string = 'default';
//const themeName:string = '1802';

// Select the theme
if (themeName === '1802') {
  require('./themes/ng2-component-lab-theme-1802.scss');
} else {
  // Default theme
  require('./ng2-component-lab.scss');
}

createLab({
  /**
   * NgModule to import. All components and pipes must be exported
   * by this module to be useable in your experiments
   */
  ngModule: ComponentsModule,
  /**
   * Function that returns an array of experiments.
   *
   * Here is an example using webpack's `require.context` to
   * load all modules ending in `.exp.ts` and returning thier
   * default exports as an array:
   */
  loadExperiments() {
    const context = (require as any).context('./../stories/ng2-component-lab', true, /\.exp\.ts/);
	  var result = context.keys().map(context).map(mod => mod.default);
    context.keys().forEach(key => {
      console.log("Going to require: " + key);
    });
    return result;
  }
});