Israel Lavi | 1994c98 | 2018-05-21 17:42:00 +0300 | [diff] [blame] | 1 | import { createLab } from '@islavi/ng2-component-lab'; |
| 2 | import { ComponentsModule } from './../stories/ng2-component-lab/components.module'; |
| 3 | |
| 4 | const themeName:string = 'default'; |
| 5 | //const themeName:string = '1802'; |
| 6 | |
| 7 | // Select the theme |
| 8 | if (themeName === '1802') { |
| 9 | require('./themes/ng2-component-lab-theme-1802.scss'); |
| 10 | } else { |
| 11 | // Default theme |
| 12 | require('./ng2-component-lab.scss'); |
| 13 | } |
| 14 | |
| 15 | createLab({ |
| 16 | /** |
| 17 | * NgModule to import. All components and pipes must be exported |
| 18 | * by this module to be useable in your experiments |
| 19 | */ |
| 20 | ngModule: ComponentsModule, |
| 21 | /** |
| 22 | * Function that returns an array of experiments. |
| 23 | * |
| 24 | * Here is an example using webpack's `require.context` to |
| 25 | * load all modules ending in `.exp.ts` and returning thier |
| 26 | * default exports as an array: |
| 27 | */ |
| 28 | loadExperiments() { |
| 29 | const context = (require as any).context('./../stories/ng2-component-lab', true, /\.exp\.ts/); |
| 30 | var result = context.keys().map(context).map(mod => mod.default); |
| 31 | context.keys().forEach(key => { |
| 32 | console.log("Going to require: " + key); |
| 33 | }); |
| 34 | return result; |
| 35 | } |
| 36 | }); |