forked from ant-design/ant-design-mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
svg.config.js
31 lines (30 loc) · 1.08 KB
/
svg.config.js
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
const path = require('path');
module.exports = (config, includeDemo) => {
let svgDirs = [
path.resolve(__dirname, 'components/icon/style/assets/'),
path.resolve(__dirname, 'components/notice-bar/style/assets/'),
path.resolve(__dirname, 'components/toast/style/assets/'),
path.resolve(__dirname, 'components/stepper/style/assets/'),
];
if (includeDemo) {
svgDirs = svgDirs.concat([
path.resolve(__dirname, 'components/steps/demo/'),
path.resolve(__dirname, 'components/icon/demo/'),
path.resolve(__dirname, 'components/popover/demo/'),
path.resolve(__dirname, 'components/action-sheet/demo/'),
path.resolve(__dirname, 'components/result/demo/'),
path.resolve(__dirname, 'components/menu/demo/'),
]);
}
// Can not process SVG files twice
config.module.loaders.forEach((loader) => {
if (loader.test && typeof loader.test.test === 'function' && loader.test.test('.svg')) {
loader.exclude = svgDirs;
}
});
config.module.loaders.unshift({
test: /\.(svg)$/i,
loader: 'svg-sprite',
include: svgDirs,
});
};