forked from haydenbbickerton/vue-animate
-
-
Notifications
You must be signed in to change notification settings - Fork 131
/
Copy pathrollup.config.mjs
131 lines (126 loc) · 2.86 KB
/
rollup.config.mjs
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import nodeResolve from '@rollup/plugin-node-resolve';
import typescript from '@rollup/plugin-typescript';
import { readFileSync } from 'fs';
import postcssDiscardComment from 'postcss-discard-comments';
import postcssHeader from 'postcss-header';
import postcssImport from 'postcss-import';
import dts from 'rollup-plugin-dts';
import { minify } from 'rollup-plugin-esbuild';
import postcss from 'rollup-plugin-postcss';
const pkg = JSON.parse(readFileSync('./package.json', 'utf8'));
const header = `/*!
* vue-animate.css - ${pkg.homepage}
* Version: ${pkg.version}
* License: MIT - see LICENSE
*
* This library is port of animate.css (https://github.com/animate-css/animate.css) to support Vue.js transitions.
* The animate.css LICENSE please see: https://github.com/animate-css/animate.css/blob/main/LICENSE
*/`;
// @see https://gist.github.com/aleclarson/9900ed2a9a3119d865286b218e14d226
export default [
{
input: 'src/animates/main.css',
output: {
file: pkg.css,
format: 'es',
sourcemap: true
},
plugins: [
postcss({
// modules: true,
extract: true,
plugins: [
postcssImport(),
postcssDiscardComment({
removeAll: true
}),
postcssHeader({ header })
]
}),
]
},
{
input: 'src/animates/main.css',
output: {
file: addMinToCssFilename(pkg.css),
format: 'es',
sourcemap: true
},
plugins: [
postcss({
// modules: true,
extract: true,
minimize: true,
plugins: [
postcssImport(),
postcssDiscardComment({
removeAll: true
}),
postcssHeader({ header })
]
}),
]
},
{
input: 'src/index.ts',
output: [
{
file: pkg.main,
format: 'cjs',
sourcemap: true,
},
{
file: pkg.browser,
format: 'umd',
sourcemap: true,
name: 'VueAnimate',
},
{
file: pkg.module,
format: 'esm',
sourcemap: true,
},
{
file: addMinToFilename(pkg.browser),
format: 'umd',
sourcemap: true,
name: 'VueAnimate',
plugins: [
minify(),
]
},
{
file: addMinToFilename(pkg.module),
format: 'esm',
sourcemap: true,
plugins: [
minify(),
]
}
],
plugins: [
nodeResolve(),
typescript({
tsconfig: './tsconfig.lib.json'
})
]
},
{
input: 'src/index.ts',
output: {
file: pkg.typings,
format: 'es',
},
plugins: [
dts({
tsconfig: './tsconfig.lib.json'
})
]
}
];
function addMinToFilename(fileName) {
return fileName.replace(/.js$/, '.min.js');
}
function addMinToCssFilename(fileName) {
return fileName.replace(/.css$/, '.min.css');
}