-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
79 lines (69 loc) · 1.69 KB
/
rollup.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
import resolve from '@rollup/plugin-node-resolve';
import html from '@web/rollup-plugin-html';
import { copy } from '@web/rollup-plugin-copy';
const MODULE_NAME = 'main.js';
const BUILD_PATH = './dist/demo/';
const SOURCE_PATH = './demo/';
const OUT_PATH = './out/';
const DIRECTORIES = [
'',
'behaviors/',
'elements/',
];
const PAGES = [
'behaviors/focus/',
'behaviors/list/',
'behaviors/overlay/',
'behaviors/scroll-table/',
'elements/collapsible/',
'elements/dialog/',
'elements/listbox/',
'elements/panel-container/',
'elements/popup/',
'elements/select/',
'elements/time/',
'elements/toggles/',
'elements/tooltip/',
];
const customWarning = (warning, warn) => {
// skip certain warnings
if (warning.code === 'THIS_IS_UNDEFINED') return;
// Use default for everything else
warn(warning);
};
export default PAGES.map(PAGE => ({
input: `${ BUILD_PATH }${ PAGE }${ MODULE_NAME }`,
output: {
dir: `${ OUT_PATH }${ PAGE }`,
format: 'iife',
},
plugins: [
resolve({
browser: true,
}),
html({
input: `${ SOURCE_PATH }${ PAGE }index.html`,
extractAssets: false,
}),
],
onwarn: customWarning,
})).concat(DIRECTORIES.map(DIR => ({
output: {
dir: `${ OUT_PATH }${ DIR }`,
},
plugins: [
html({
input: `${ SOURCE_PATH }${ DIR }index.html`,
extractAssets: false,
}),
...[DIR === ''
? copy({
patterns: [
'assets/svg/*',
],
rootDir: './src',
})
: []
],
],
})));