forked from bebraw/colorjoe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
48 lines (43 loc) · 1.06 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
const fs = require('fs');
const pathModule = require('path');
const pkg = require('./package.json');
const now = new Date();
const yyyymmdd = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`
const config = {
input: 'src/mycolorpicker.js',
output: {
file: 'dist/mycolorpicker.js',
name: 'mycolorpicker',
format: 'umd',
sourcemap: true,
banner: `/*! ${pkg.name} - v${pkg.version} - ${pkg.author} - ${pkg.license}\n${pkg.homepage} - ${yyyymmdd} */`
},
watch: {
paths: 'src/**'
},
plugins: [
require('rollup-plugin-commonjs')(),
require('rollup-plugin-node-resolve')()
]
};
const minifiedConfig = {
...config,
output: {
...config.output,
file: 'dist/mycolorpicker.min.js',
},
plugins: [
...config.plugins,
require('rollup-plugin-uglify').uglify({
output: {
comments(node, comment) {
return /^!|@preserve|@license|@cc_on/i.test(comment.value);
}
}
})
]
};
module.exports = [
config,
minifiedConfig
];