summaryrefslogtreecommitdiffstats
path: root/.storybook/webpack.config.js
blob: a923d804d7db6d9a00632cc0ae0f7dcc4e98d045 (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
37
38
39
const path = require('path');
const webpack = require('webpack');
const svgFolder = './assets/icons/';
const fs = require('fs');

let iconNames = [];

fs.readdirSync(svgFolder).forEach(file => {
	let fileName = file.split('.');
	if (fileName[0] && fileName[1] === 'svg') {
		iconNames.push(fileName[0]);
	}
});

module.exports = {
	module: {
		rules: [
			{
				test: /.scss$/,
				use: ['style-loader', 'css-loader', 'sass-loader'],
				include: path.resolve(__dirname, '../')
			},
			{
				test: /.html$/,
				loader: 'html-loader',
				options: {
					minimize: false
				}
			}
		]
	},
	plugins: [
		new webpack.DefinePlugin({
			'ICON_PATH': '"./"',
			'ICON_NAMES':JSON.stringify(iconNames)
		})
	]
};